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
johanfire:
20211013 04:45:28
I got it but it's exceding time limit, I wrote 19 lines of code :( 

kemar:
20210917 18:06:08
It seems that the last line of the input file doesn't end with a '\n'.


adam____:
20210826 16:31:47
Big thanks to @shreyas_07 for TCs, done in bout 1.5h, be careful with inverting the order of digits and with odd and even number of them. 

novinsky1:
20210819 09:00:15
yes, it passed :D 

freaking_omen:
20210819 08:18:34
Testcases given by Shreyas all are passed but not accepted 

novinsky1:
20210819 08:12:14
what is wrong in <snip> ?


deepak_07:
20210811 11:36:17
can anyone explain the concept 

happydracula:
20210623 15:31:46
FUCK YES


loser_404:
20210602 16:17:08
One of the best problems ever faced. 

botter_code:
20210602 12:54:39
lessgoo

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