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
techventer_936:
20171130 23:55:21
consider special cases and for all other logic is same.


w1583236:
20171129 06:31:57
what about 19199192 

coolbudy1998:
20171124 16:46:21
Please provide a sample of a number with 53435 digits...i think my whole computer screen will fill away. Is the language given in prob statement is wrong?? 1000000 digits should be replaced with only 1000000. Isn't it?


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 
Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 