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 | 75 c. | Top 17% | |
#2 | 82 c. | Top 33% | |
#3 | 87 c. | Top 50% | |
#4 | 88 c. | Top 67% | |
#5 | 148 c. | Top 83% | |
#6 | 174 c. | Top 100% |