题解 | #名字的漂亮度#
名字的漂亮度
https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
n = int(input()) for i in range(n): name = input() d = {} for word in name: if word not in d: d[word] = 1 else: d[word] += 1 index = 26 total = 0 dd = sorted(d.values(),reverse=True) for word in dd: total = total + word * index index -= 1 print(total)