codeeval - BeautifulStrings problem

Count characters, sort by value.