 Find the largest number
##### Submissions: 1574   Accuracy: 16.14%   Difficulty: Medium   Marks: 4

Given an integer N the task is to find the largest number which is smaller or equal to it and has its digits in non decreasing order.

Examples:

Examples:

```Input  : n = 200
Output : 199
If the given number is 200, the largest
number which is smaller or equal to it
having digits in non decreasing order is
199.

Input  : n = 139
Output : 139```

Input:
The first  line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contain an integer N.

Output:
For each test case in a new line print the required output.

Constraints:
1<=T<=200
1<=N<=100000000

Example:
Input:

2
200
139
Output:
199
139

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

Author: Shubham Joshi 1

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.