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
gopala krishna:
2015-02-24 14:59:54
i have a small doubt.
|
|
rish:
2015-02-21 15:53:21
can we post our code here?i just want to know what am i doing wrong? my code seems to work fine ,but still getting WA . |
|
Yash:
2015-02-07 11:41:13
Same code AC in C, but NZEC in Java ...Something's fishy :/ |
|
Yi-Shan Chen:
2015-02-07 04:41:33
Note for WA:
|
|
JATIN ARORA:
2015-02-02 06:42:26
I am always getting the error (SIGXFSZ).Please help me to remove this error.
|
|
Alexander K:
2015-01-31 18:06:09
>>>given positive integer K of not more than 1000000 digits<<<
|
|
piyukr:
2015-01-31 09:28:20
Note: There will be NO newline char at the end of last test case.
|
|
Anshul:
2015-01-30 17:36:14
what is the solution to single digit inputs |
|
vasu:
2015-01-30 15:06:56
Can this program have an input of the type 00002?
|
|
Sreeraj:
2015-01-23 08:42:06
2015-01-14 14:05:49 Anirudha Bose
|
Added by: | adrian |
Date: | 2004-05-01 |
Time limit: | 2s-9s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 |