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

import sys

str_input = input()
set_input = set(str_input)
list_count = []
for ch in set_input:
    count = str_input.count(ch)
    list_count.append(count) 

min_count = min(list_count)

for ch in set_input:
    count = str_input.count(ch)
    if count == min_count:
        str_input = str_input.replace(ch,"")

print(str_input)

全部评论

相关推荐

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