题解 | #字符统计#
字符统计
http://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0
while True: chars = [] total = [] ret = {} try: s = input() except EOFError: break for c in set(s): if c not in chars: chars.append(c) count = s.count(c) if count not in ret: ret[count] = [c] total.append(count) else: ret[count].append(c) total.sort(reverse=True) for i in total: ret[i].sort() for c in ret[i]: print(c, end='') print("")