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
Martijn Muijsers:
20140115 15:17:31
Great problem, but some wrong answers appear to be accepted? :P 

Shashank Gupta:
20140115 15:17:31
Good problem. Just be very careful with what functions/operations you use in your language. Even in slower languages, this problem is easy to do with the high time limit. 

Sachin Sai Krishna M:
20140115 15:17:31
for 9 the ans should be 11 but if even 9 gets printed u can get AC:) pls check that one 

Gaurav Mishra:
20140115 15:17:31
To much hard coding :( 

ISHANI:
20140115 15:17:31
GREEN LINE after hard hard coding


Abhash Singh:
20140115 15:17:31
3.5 hrs straight into this one!


Bernardo de Freitas Zamperetti:
20140115 15:17:31
make sure that your program can accept numbers with at least 1000000 *DIGITS* Last edit: 20130503 15:22:37 

Guo Zhiming:
20140115 15:17:31
The version of Clojure is tooooo old. can anybody update it to 1.3 or 1.5? 

Shrinidhi Sondur:
20140115 15:17:31
This one was good. Real good. If you stick to it for some time you'll crack it. 

lukan thorare:
20140115 15:17:31
http://ideone.com/******

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