Wrong answer for PALIN

The Next Palindrome

My code: http://www.codechef.com/viewsolution/2362069

I have tested my code for many cases on my computer and it gives correct answer for all of them, but the online judge is not accepting it. Can somebody help me find the error in this code? Please tell me if you know some tricky test cases which are likely to make people get wrong answers.

I think the online judge should tell us which test case is giving wrong answer.

Some test cases I tried and their answers:

  • 1122334455667788998877665544332211 1122334455667789009877665544332211
  • 1 2
  • 9 11
  • 999 1001
  • 9999 10001
  • 120 121
  • 121 131
  • 122 131

Your code is not working for 9s, see x2XQl2 - Online C++ Compiler & Debugging Tool - Ideone.com

1 Like