#K10081. Smallest Palindromic Number
Smallest Palindromic Number
Smallest Palindromic Number
This problem requires you to find the smallest palindrome number which is strictly greater than a given number. A palindrome is a number that reads the same backward as forward. For example, 121, 1331, and 12321 are palindromic numbers.
You are given \( T \) test cases. For each test case, you are provided with a number \( N \) in string format. Your task is to compute the next palindrome \( P \) such that \( P > N \) and \( P \) is a palindrome.
For instance, if \( N = 123 \), the next palindrome will be \( 131 \), and if \( N = 898 \), the next palindrome is \( 909 \).
inputFormat
The input is read from standard input (stdin). The first line contains an integer \( T \) which represents the number of test cases. Each of the following \( T \) lines contains a single number \( N \) (given as a string) for which you need to compute the smallest palindrome greater than \( N \).
outputFormat
For each test case, output the smallest palindrome greater than \( N \) on a separate line to standard output (stdout).
## sample3
123
898
2001
131
909
2002
</p>