题解 | #名字的漂亮度#简单易懂
名字的漂亮度
http://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
n = int(input())
while 1:
try:
lst = list(input())
dic = {}
for x in lst:
if x in dic.keys():
dic[x] += 1
else:
dic[x] = 1
res = []
for x in dic.keys():
res.append((x,dic[x]))
res.sort(key = lambda x:x[1], reverse=True)
ret = 0
num = 26
for i in range(len(res)):
ret += res[i][1] * num
num -= 1
print(ret)
except:
break