题解 | #名字的漂亮度#
名字的漂亮度
https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3
#非常暴力,出现最多的字母乘以26,然后次之 n=int(input()) for i in range(n): dic={} l=input() for i in l: if i not in dic: dic[i]=1 else: dic[i]+=1 num=[] for i in range(26,26-len(dic),-1): num.append(i) s=sorted(dic.items(),key=lambda x:x[1],reverse=True) m=0 for i in range(len(s)): m+=s[i][1]*num[i] print(m)