题解 | #字符统计#

字符统计

https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0

ent = input()
ent_list = [i for i in ent]
ent_sort = {}
for i in set(ent_list):
    c = ent_list.count(i)
    ent_sort.setdefault(c,[])
    ent_sort[c].append(i)
dec = sorted(ent_sort.keys(), reverse=True)
out = []
for i in dec:
    ent_sort[i].sort()
    out += ent_sort[i]
for i in out:
    print(i,end='')

全部评论

相关推荐

热爱生活的咸鱼在吃瓜:个人建议,项目太简单了,实习干的活都是测试的活,反正又没人知道你实习干啥了,你懂吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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