python 字典+sorted
while True: try: dic = {} for i in input(): if i in dic: dic[i] += 1 else: dic[i] = 1 a = list(dic.keys()) a.sort() sort = sorted(a, key = lambda x:dic[x], reverse=True) print(''.join(sort)) except: break
python 字典+sorted
while True: try: dic = {} for i in input(): if i in dic: dic[i] += 1 else: dic[i] = 1 a = list(dic.keys()) a.sort() sort = sorted(a, key = lambda x:dic[x], reverse=True) print(''.join(sort)) except: break