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

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

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

while True:
    try:
        s=input().strip()
        #出现次数最少是
        l=len(s)
        for i in set(s):
            n=s.count(i)
            if n<l:
                l=n
        #结合非出现次数最少的字符
        ns=''
        for i in s:
            if s.count(i)!=l:
                ns+=i
        print(ns)
    except:
        break
全部评论

相关推荐

06-15 18:44
黄淮学院 Java
Lynn012:如果是居民楼还是算了吧,看着有点野呢
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 11:30
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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