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
Added by:  Adrian Kosowski 
Date:  20040501 
Time limit:  2s9s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel Pentium G860 3GHz) 
Languages:  All except: NODEJS PERL 6 SCM chicken 
hide comments
Vamsi Krishna Avula:
20150327 19:34:15
@cyclops, just wondering what is length of your code for this problem? 

VigneshR:
20150327 19:03:17
http://ideone.com/j1cmgT


Ilya Tetin:
20150326 23:45:06
Getting TLE in Java. :(


Ramesh:
20150326 14:23:29
i'm using c#.code runs at Ideone.com, but when submit the solution, it gives runtime error.. Please provide the answer for it. I gave the input values in Ideone.com, when submit the solution there is no place to give the input values.. please give the reply for this. Last edit: 20150326 14:24:05 

Seven.Martinez:
20150323 20:35:17
Got this using JAVA Last edit: 20150323 22:46:06 

copperfield:
20150316 21:05:20
Great problem! 

RFarrell:
20150316 16:03:32
Why aren't single digit numbers considered palindromes? They should be. Mine kept failing until I forced it to output 11 on any single digit.


minhthai:
20150315 11:06:27
very good problem :) 

Manish Mishra:
20150307 21:58:12
I wrote the program and it works fine and gives the results as expected. But still when I submit it here, it says wrong answer.
