I am trying to sort letters by frequency in a string. In the case that two or more letters have the same frequency, the letters with the same frequency would be sorted in alphab