Wrong Answer in next smallest palindrome problem(PALIN)

I applied this approach in next smallest palindrome PALIN

my Solution http://ideone.com/QUSKZe

Please help me where i am wrong.

Thank You