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 the 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
34 65 99 10 22 | 1 22 34 56 99 |
Constraints
Time limit: 2.4 seconds
Memory limit: 512 MB
Output limit: 1 MB