class Solution(object): def frequencySort(self, s): return ''.join([char * num for char, num in sorted(collections.Counter(s).items(), key=lambda x: x[1], reverse=True)])