1 test case not passing code link - https://ide.codingblocks.com/s/194063
No need of if conditions in lines 26 and 32.