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

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

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

# -*-coding:utf-8-*-
import math
while True:
    try:
        input_str=input()
        input_str_2=list(set(input_str))
        len_s=int(len(input_str_2))
        v = [0]*len_s
        for i in range(len_s):
            v[i]=input_str.count(input_str_2[i])
        x = min(v)
        for j in range(len_s):
            if x==input_str.count(input_str_2[j]):
                input_str=input_str.replace(input_str_2[j],'',x)
        print(input_str[:])
    except:
        break
全部评论

相关推荐

09-19 13:59
门头沟学院 Java
用微笑面对困难:Trae一下,如果真成了,他用了直接发字节起诉代码版权,,这个代码不商用是没问题的如果没成也是情理之中的。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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