题解 | 删除字符串中出现次数最少的字符

删除字符串中出现次数最少的字符

https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9

from collections import defaultdict

inputs = input()
dic = defaultdict(int)
for c in inputs:
    dic[c] += 1

MIN = min(dic.values())
for k, v in dic.items():
    if v == MIN:
        inputs = inputs.replace(k, "")

print(inputs)


全部评论

相关推荐

03-03 19:02
已编辑
东华理工大学 Node.js
点赞 评论 收藏
分享
02-04 17:01
南昌大学 Java
牛客96763241...:拿插件直接投就完了,这玩意看运气的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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