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
loser_404:
20210602 16:17:08
One of the best problems ever faced. 

botter_code:
20210602 12:54:39
lessgoo


ninh0855250956:
20210510 08:40:49
2 hrs got AC 

slash_1:
20210414 19:55:48
why the next palindrome of 0003 is 0110 and not 4 ? 

rushi2001:
20210322 21:59:34
Started On 12 am


wowthecoder:
20210320 08:39:44
AC with Java after 56 TLEs...


adrian_mole:
20210222 01:56:55
The challenge clearly states: "Numbers are always displayed without leading zeros." So, how does 0003 give 0110 (one leading zero) not 4? And how does 0012100 give 0013100 (two leading zeroes) rather than 12121? 

makhan_28:
20210220 10:26:58
Good Problem!!


rahultwr_ankur:
20210219 14:47:33
After 2 hour struggling ..finally got AC..


wille_25:
20210108 20:58:32
Finally AC  (0.02s)

Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 