题解 | #字符统计#
字符统计
https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0
while True:
try:
s = input()
l = list(set(s))
l.sort(key=lambda c: (-s.count(c), c)) # count on string s not set list l
print(''.join(l))
except:
break
排序标准:
- 先按照出现次数逆序
- 再对次数相等的进行ASCII顺序

