#K5966. Next Palindrome Numbers
Next Palindrome Numbers
Next Palindrome Numbers
You are given a number n. Your task is to find the smallest palindrome number strictly greater than n.
A number is considered a palindrome if it reads the same forward and backward. Mathematically, a number n is a palindrome if \[ n = \overline{a_1a_2\dots a_k} \] and it satisfies \[ a_i = a_{k-i+1} \quad \text{for } 1 \leq i \leq k. \]
You need to process multiple test cases. For each test case, calculate and output the smallest palindrome number greater than the given input.
inputFormat
The input is given via stdin in the following format:
- The first line contains an integer
T
representing the number of test cases. - The following
T
lines each contain an integern
.
outputFormat
For each test case, output on a new line the smallest palindrome number that is strictly greater than the given integer.
The output should be written to stdout.
## sample3
123
808
999
131
818
1001
</p>