题解 | #字符统计#
字符统计
https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0
import string
from collections import Counter
while True:
try:
char_count = Counter(input())
sorted_count = sorted(char_count.items(), key=lambda x: (-x[1], x[0]))
res=""
for char, count in sorted_count:
res+=char
print(res)
except:
break