PALIN  The Next Palindrome
A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros.
Input
The first line contains integer t, the number of test cases. Integers K are given in the next t lines.
Output
For each K, output the smallest palindrome larger than K.
Example
Input: 2 808 2133 Output: 818 2222
Warning: large Input/Output data, be careful with certain languages
hide comments
malavan:
20160924 15:45:02
@narutohokage_1 ip 00000 op 00100... is not violating the principle of palindrome ???


narutohokage_1:
20160924 13:06:20
For All People Who Are Getting WRONG ANSWER MANY Times....


balaji_04:
20160923 18:52:30
it always show runtime error, segmentation fault(SIGSEGV) . i got the right output in diff compilers.


avishek_arora:
20160922 20:33:12
I'm using python, guy any hints regarding this problem? Last edit: 20160922 20:35:19 

avishek_arora:
20160922 20:33:12
If it's something else then let me know. Last edit: 20160922 20:34:40 

avishek_arora:
20160922 20:33:12
@malavan i Think if you entered a single digit number less than 9, the next palindrome would be that number + 1, according to the palindrome definition. 

malavan:
20160922 15:23:33
if the input is single digit ,is that output will be 11 ???? 

nishabha:
20160913 16:06:34
@imad315: It's the no. of times your code will be run for different sets of input.


shaan001:
20160905 12:52:01
NZEC java.... 

sifors:
20160903 22:21:19
What wrong with this compiler? My solution dont accept every time but on VS it is running smoothly (( 
Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL 6 