Getting WA for next palindrome

Please help! I have run my code for several test cases and getting correct output! Can anyone tell me what’s wrong with my code or provide any testcases!!!

http://www.codechef.com/viewsolution/4697084