The score of a lowercase English string is the sum of the squares of the frequencies of its letters. For example, abaca has score .
Sort the strings by the following rules.
abc precedes abd.Repeated strings must be printed as many times as they occur in the input.
The input is given in the following format.
Print the sorted strings on lines, one string per line.
The first line gives . Each of the next lines gives one string.
| 2 |
| 19 |
No letter occurs more than once within any string. |
| 3 | 8 | Each string consists of only one distinct letter. |
| 4 | 13 | All strings have distinct scores. |
| 5 | 7 | . |
| 6 | 7 | . |
| 7 | 35 | No additional constraints. |