Problems
557 - Biggest Number
SUBMIT PROBLEM

Biggest Number

Time Limit: 0.5 sec

 

The Problem

Given a positive integer n that contains not more than 100 digit. You can perform at most one swap operation where any two digit will exchange their position.

 

Now find the biggest number that you can obtain.

 

The Input

Input starts with an integer T (1 ≤ T ≤ 20), denoting the number of test cases.

Each case contains a single integer n.

It is guaranteed that n doesn’t contain any leading zero.

 

The Output

For each case, just print biggest number that you can obtain.

 

Sample Input

2

132454

54541

 

Sample Output

532414

55441

 

 

Note:

In the first case biggest number can be obtained if we swap 1 and 5.

 

 

Problem Setter: Sheikh Monir [Bangabandhu Sheikh Mujibur Rahman Science and Technology University]