牛客华为机试HJ102
作者:互联网
1. 题目描述
2. Solution
import sys
if sys.platform != "linux":
sys.stdin = open("input/HJ102.txt")
def solve(s):
from collections import Counter, defaultdict
res = Counter(s).most_common()
cnt_group = defaultdict(list)
for c, cnt in res:
cnt_group[cnt].append(c)
for cnt, c_group in cnt_group.items():
c_group.sort()
[print(x, end="") for x in c_group]
print()
for line in sys.stdin:
s = line.strip()
solve(s)
标签:defaultdict,cnt,group,res,print,sys,牛客,HJ102,机试 来源: https://www.cnblogs.com/junstat/p/16181410.html