Double sorting
Given n
numbers, you are asked to perform double sorting. Double sorting can be described as first sorting all the digits of a number in increasing order, and afterward sorting the whole list of numbers in increasing order.
The first line of the input contains the number n
, which is followed by the second line which contains space-separated n
numbers.
The output of the program should contain the resulting list of numbers after double sorting.
Input | Output |
---|---|
5 | 1 22 34 56 99 |
5 | 159 1449 1678 3479 34688 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB