题解 | #名字的漂亮度#

名字的漂亮度

https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3

n = int(input())
c_list = []
for i in range(n):
    c_list.append(input())
for c in c_list:
    str_list =list(c)
    from collections import Counter
    count_dict = Counter(str_list).most_common()
    res = 0
    for i in range(len(count_dict)):
        res += count_dict[i][1]* (26-i)
    print(res)

#od#
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务