Python题解 | #字符统计#
字符统计
https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0
import sys
from collections import Counter
while True:
try:
s = input()
arr = Counter(s)
dict1 = sorted(arr.items(), key=lambda x: x[0], reverse=False)
dict1 = sorted(dict1, key=lambda x: x[1], reverse=True)
for i in dict1:
print(i[0], end='')
except:
break
查看14道真题和解析