题解 | #名字的漂亮度#
名字的漂亮度
https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
N = input()
while True:
try:
s = input()
l = []
l1 = []
for i in s:
if i not in l:
l.append(i)
for i in l:
count = s.count(i)
l1.append(count)
l1 = sorted(l1,reverse=True)
beauty = 0
for i in range(26,26-len(l),-1):
beauty += i*l1[26-i]
print(beauty)
except:
break
快手公司福利 1244人发布