Trisha's Number
Submissions: 587   Accuracy:

47.71%

  Difficulty: Easy   Marks: 2

Trisha is very good at maths. One day she was discussing palindromes. Her teacher asks Trisha to explain palindromes to the class, after doing so, her teacher asks her to find the smallest palindrome greater than 10, Trisha in no time answers the question answer: 11, moving forward her teacher starts asking her the same question for large values. As Trisha does not want to lose her reputation in the class, she asks you for help.

Input: 
The first line of the input contains an integer T denoting the number of test cases. The description of each test case is as follows. Each test case contains a single line with one integer ' X ' for which you have to find the smallest palindrome greater than the input number (X).

Output: For each X, output the smallest palindrome greater than X.
Constraints: 
1 < = T < = 10000
1 < = X  < = 10000

Example:
Input:
4
23
189
10009
33

Output:
33
191
10101
44

Explanation:  For the first test case 23 the smallest number which is a palindrome and greater than 23 is 33. 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Diksha Singhal
Author: diksha1812


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.