Solution : https://ide.codingblocks.com/s/298057
problem: https://online.codingblocks.com/app/player/69347/content/128042/4932/code-challenge
@Shrey0709 corrected and commented