# 解题思路:字典存储计数信息 20190302 找工作期间
class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
dict1 = {}
result = str()
for i in range(len(s)):
if s[i] not in dict1:
dict1[s[i]] = 1
else:
dict1[s[i]] += 1
while len(dict1) > 0:
m = max(dict1, key=dict1.get)
result += m * dict1[m]
del dict1[m]
return result