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
dsr:
20171119 21:30:23
Why am I getting NZEC for python :'(


prothlete:
20171118 17:52:17
in my ide, i get the correct answer against every possible test case, but here, why does it show wrong answer? 

w1583236:
20171108 20:51:02
My code exceeded the time limit. Does that imply there would be any redundancy in my code ? 

gauravsood_:
20171031 14:57:27
use string not integer, refer to geeks for geeks article for next palindrome, don't forget to include case 0000000 and 000000xxxx where xxx can be any number. goodluck :) 

manjeet_:
20171030 14:22:55
there are no cases like 001 .. so dont worry.. i've submitted without even checking them


manjeet_:
20171029 13:37:22
Last edit: 20171030 14:23:24 

gaurav__404:
20171026 17:18:03
a small mistake can waste your 3 hours ; every thing is mentioned in this question and end line is important 

neildcruze:
20171026 07:29:50
Why is it showing compilation error? When I run the same code on my computer, it works perfectly. 

marcognox:
20171019 15:41:48
Theoden's test cases are recommended, plus "23726 > 23732" (this case took me a lot of time to figure out) 

vivace_jr:
20171007 15:24:44
000 gives 010 as output...huh..this is bad 
Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 