Sort a string by the frequency of each character.
Given a lowercase string, return a new string sorted by the frequency of each character in descending order, followed by the characters in alphabetical order if frequencies are the same.
Example: For mississippi the output should be iiiissssppm
# | Size | % | Users |
|---|---|---|---|
#1 | 73 c. | Top 24% | |
#2 | 75 c. | Top 35% | |
#3 | 76 c. | Top 41% | |
#4 | 80 c. | Top 47% | |
#5 | 82 c. | Top 53% | |
#6 | 87 c. | Top 59% | |
#7 | 88 c. | Top 65% | |
#8 | 95 c. | Top 71% | |
#9 | 100 c. | Top 76% | |
#10 | 148 c. | Top 82% | |
#11 | 174 c. | Top 88% | |
#12 | 212 c. | Top 94% | |
#13 | 1240 c. | Top 100% |