Smallest number by rearranging digits of a given number
Easy Accuracy: 40.75% Submissions: 2822 Points: 2

Find the Smallest number (Not leading Zeros) which can be obtained by rearranging the digits of given number.

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

Output:
Print the smallest number which can be made by rearranging the digits of the given number.

Constraints:
1 <= T <= 100
1 <= N <= 101000

Example:
Input:
2
846903
55010

Output:
304689
10055

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Output Window