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
Ankit:
20141227 05:17:21
Its a general question. I am not sure of the answer.


Petar Jesic:
20141226 20:40:53
@Dan: thanks a million, had that problem. 

Yogesh Jindal:
20141225 09:52:32
Last edit: 20141225 09:57:09 

Dan Pallas:
20141218 02:39:53
One thing that isn't really part of the problem that caused me some issues. The last (at least I assume it was the last) input doesn't have a newline character in it. Don't assume that all inputs do. 

LabdaABeta:
20141215 19:58:49
@naman gupta (and others)


Manglesh Sharma:
20141209 19:12:15
what is expected in case where the integer has more than 1000000 digits


numerix:
20141209 18:07:54
@Kushagra Bhatnagar: Why do you post your comment here, though it was a problem with your submissions for FIBOSUM?


Kushagra Bhatnagar:
20141209 15:11:40
My Code Is running Fine In Python


naman gupta:
20141208 15:16:38
http://ideone.com/t6jt6b


Dawid:
20141206 23:58:21
Hi guys, why does it say "compilation problem" while ideone runs it smooth? (C++). 
Added by:  adrian 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 