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
Added by:  Adrian Kosowski 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel Pentium G860 3GHz) 
Languages:  All except: NODEJS PERL 6 SCM chicken 
hide comments
SON_OF_SPARDA:
20150525 19:43:24
problem took time but...


deep_07:
20150522 14:49:42
All sorts of test cases checked but still getting a WA, can anybody pls check?


Ptotheextreme:
20150522 12:53:23
i have fallen into the "i have every test correct but still WA" club... 

sohail01:
20150519 11:25:17
How many test cases max? Is it mentioned anywhere? Last edit: 20150519 11:46:04 

munex:
20150518 17:51:56
How can I "like" this problem ? 

Rakend Chauhan:
20150517 15:26:22
finally got it right! 

shivam chandra:
20150515 14:19:24
9 4 1 8 7 9 7 8 3 2 2>9 4 1 8 8 0 8 8 1 4 9


rahulsingh80:
20150514 08:07:16
Finally! Got it right!! I feel like I should get a trophy for this. :)


arekz:
20150512 08:41:39
Hi, on all colected in comments cases I get correct answer but still I get WA in jugde system. (see: http://ideone.com/ufyoiZ )


Anakar Parida:
20150508 21:39:22
For the below input it took 0.002547891 sec
