WA with PALIN

Problem Link : http://www.codechef.com/problems/PALIN/

Soure Code : http://ideone.com/QZu8on

No idea why this is not working. I have tested with many test cases, but all of them work just fine.

It fails for one digit numbers…

You probably missed “output the smallest palindrome larger than K” part…