Pile of books(stack)

https://ide.codingblocks.com/s/64628
It is showing correct ans for sample case but not for other test cases what is wrong?

Hi Kiran, just insert a new line after printing No Code. I’ve done it here in your code https://ide.codingblocks.com/s/64728