题解 | #名字的漂亮度#
名字的漂亮度
http://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
while True:
try:
num = int(input())
pld = range(26,0,-1)
for i in range(num):
name = input()
chars = list(dict.fromkeys(name))
counts = [ name.count(i) for i in chars ]
counts.sort(reverse=True)
max_pld = [ pld[j]*counts[j] for j in range(len(counts))]
print(sum(max_pld))
except:
break