题解 | #字符串归一化#
字符串归一化
https://www.nowcoder.com/practice/6d5e036defdf408681376a4a9d4930ff
ss = input() dd = {} for i in ss: if i in dd: dd[i] += 1 else: dd[i] = 1 dd = sorted(dd.items(),key = lambda x:x[0]) dd = {i[0]:i[1] for i in dd} ans = '' for item in dd.items(): ans += item[0] ans += str(item[1]) print(ans)