Given a positive palindrome number P up to 10,000,000 digits. Find the next palindrome.
Input
The first line contains integer n, the number of test cases. Integers P are given in the next t lines.
Output
For each P, output the next palindrome larger than P.
Example
Input:
12
1
9
12
99
101
999
1001
808
900000000000000000000000000000000000009
123454321
1999999999991
199999999991
Output:
2
11
23
101
111
1001
1111
818
900000000000000000010000000000000000009
123464321
2000000000002
200000000002
#include
#include
#include
Code on ideone