题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
def func(s):
dic, res = {}, ''
for c in s:
if c not in dic:
dic[c] = 1
else:
dic[c] += 1
min_count = min(dic.values())
for c in s:
if dic[c] != min_count:
res += c
return res
while 1:
try:
s = input()
print(func(s))
except:
break
查看6道真题和解析
网易游戏公司福利 555人发布
