am i missing something in the next palindrome

i dont know why my code is giving wrong answer , it works very fine on my machine , suggest test case here’s the link CodeChef: Practical coding for everyone

@ana1nd_9 it is quite difficult to understand ones code so i suggest you to have a look on my code i think then you will get where are you missing if even not then feel free to comment here again.

here is the link to my code CodeChef: Practical coding for everyone

here is link to my code CodeChef: Practical coding for everyone