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 8% | |
#2 | 75 c. | Top 25% | |
#3 | 78 c. | Top 33% | |
#4 | 80 c. | Top 42% | |
#5 | 82 c. | Top 50% | |
#6 | 87 c. | Top 58% | |
#7 | 88 c. | Top 67% | |
#8 | 95 c. | Top 75% | |
#9 | 148 c. | Top 83% | |
#10 | 174 c. | Top 92% | |
#11 | 212 c. | Top 100% |