题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
http://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
#replace总是出错,因为错误了理解replace的用法,它只是不改变原变量的暂时性替换。例如s="str";s.replce('r','a')->'sta', s仍然为'str'.
while True:
try:
s=input()
dic=dict()
for i in s:
if i in dic:
dic[i]+=1
else:
dic[i]=1
m=min(dic.values())
for i in s:
if dic[i] == m:
s=s.replace(i,'')
print(s)
except:
break