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
ragwave:
20160524 16:18:50
Finally accepted after 2 WA! check for tricky cases:


Kirill Diduk:
20160524 14:57:36
In this problem, it is expected that a singledigit number is NOT a palindrome. So, when you get a singledigit number as an input, the output should be 11.


xinnix:
20160521 14:47:44
Wth! Working everytime in my compiler but says wrong output here.... What's going on?


avisheksanvas:
20160518 08:51:54
Be careful while comparing.


Gaurav Kumar:
20160512 14:37:59
hey , Is 1000 a palindrome ?


earlgreyhot:
20160511 22:25:19
If you use recursion you will get NZEC (in python at least) 

boney_412:
20160510 20:22:01
Can anyone tell me how to rectify NZEC runtime


palash_123:
20160509 14:00:37
I'm unable to get the output to thi question.


roisym:
20160504 14:40:58
This is a great problem! I'm a beginner (this is my 10th day learning programing from nothing). It took me many tries but finally got accepted(c#). Tips for beginners like myself (POSSIBLE SPOILER ALERT):


subham92:
20160427 14:06:43
time limit exceeded :( But it takes only 0.2 secs in ideone 
Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL 6 