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

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

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

str = input()

list=[]
length = []
temp=[]
result=''
for i in str:
    if(i in list):
        continue
    else:
        list.append(i)
for i in list:
    length.append(str.count(i))

min_value = min(length)
for i in list:
    if(str.count(i)==min_value):
        temp.append(i)
for i in str:
    if(i in temp):
        continue
    else:
        result=result+i
print(result)

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务