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

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

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
全部评论

相关推荐

牛客83265014...:完了,连现在都没开始面,13号投的是不是晚了
秋招的第一个offer,...
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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