题解 | #名字的漂亮度#
名字的漂亮度
https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
while True: try: line = int(input()) for l in range(line): string = input() dic = {} max, base = 0, 26 for c in string: dic[c] = dic.get(c,0) + 1 # print(dic) p_dic = dict(sorted(dic.items(), key=lambda item: item[1],reverse=True)) # print(p_dic) for v in p_dic.values(): max += v*base base -= 1 print(max) except: break