题解 | #名字的漂亮度#

名字的漂亮度

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

全部评论

相关推荐

抱抱碍事梨a:三点建议,第一点是建议再做一个项目,把自我介绍部分顶了,第二点是中南大学加黑加粗,第三点是建议加v详细交流
点赞 评论 收藏
分享
哥_留个offer先:跟他说,你这个最好用c#,微软就用c#Java不适合这个项目
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务