Python函数多,可设置的参数也多
while True:
try:
N=int(input())
for i in range(N):
name_alpha_array=list(input().lower())
dic={}# 存储字符以及其出现的次数
for e in set(name_alpha_array):
dic[e]=0 # 初始化一下dic
for x in name_alpha_array:
if x in dic:
dic[x] += 1
Num=0
L=sorted(dic.values(),reverse=True) # 降序,获取所有的数值
for i in range(len(L)):
Num+=int(L[i])*(26-i)
print(Num)
except:
break