WA with PALIN

Problem Link : PALIN Problem - CodeChef

Soure Code : QZu8on - Online C++ Compiler & Debugging Tool - Ideone.com

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…