PROGRAMMING:Screening by purity
Problem Description:
In mining, an ore contains many components. The less the composition of the ore, the higher the purity. Nowadays, a string composed of lowercase letters is used to represent the ore, the length of the string represents the times of measurement of the ore, and the different character types of the string represent the number of components. There are no spaces in the string. If the number of measurements is fixed and the fraction measured is less, the trial production will be given priority.
###Input format:
The first integer of each group is n, indicating that there are n ore samples that have been tested. If 0 is encountered, it means the end of input.
###Output format:
For each group of data, it is arranged from good to bad in terms of purity. If the purity is the same, it is arranged from large to small in terms of length. If the length is the same again, it is arranged in dictionary order. Each ore sample takes up one row. There is a blank line between each group of data.
###Input example:
Here is a set of inputs. For example:
```in
three
asdfds
ewrewrt
ert
two
www
aaa
0
```
###Output example:
The corresponding output is given here. For example:
```out
ert
ewrewrt
asdfds
aaa
www
```
answer:If there is no answer, please comment
In mining, an ore contains many components. The less the composition of the ore, the higher the purity. Nowadays, a string composed of lowercase letters is used to represent the ore, the length of the string represents the times of measurement of the ore, and the different character types of the string represent the number of components. There are no spaces in the string. If the number of measurements is fixed and the fraction measured is less, the trial production will be given priority.
###Input format:
The first integer of each group is n, indicating that there are n ore samples that have been tested. If 0 is encountered, it means the end of input.
###Output format:
For each group of data, it is arranged from good to bad in terms of purity. If the purity is the same, it is arranged from large to small in terms of length. If the length is the same again, it is arranged in dictionary order. Each ore sample takes up one row. There is a blank line between each group of data.
###Input example:
Here is a set of inputs. For example:
```in
three
asdfds
ewrewrt
ert
two
www
aaa
0
```
###Output example:
The corresponding output is given here. For example:
```out
ert
ewrewrt
asdfds
aaa
www
```
answer:If there is no answer, please comment