Single Digit - 1 Since it is single digit, output "11"
1000 -> Even number of digits
Create a mirror image:
1001. Since this is greater than the given input number, the next palindrome is 1001.
99-> Even Number of digits
Mirror image: 99. These kind of cases where one or all the digits are 9 are handled separately. It produces 101.
100 -> Odd number of digits
Mirror Image: 101. Since it is greater than input number, print 101
101 -> Odd number of digits. Mirror image -101. Since it is same as input number, increment centre digit. So it becomes 111
Would be glad to explain the code in detail, but I'm looking for test cases which break this code since it seems to work fine even for 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000