while True:
try:
words = list(map(str,input()))
dic_words={}
new_words = ''
for word in words:
if word not in dic_words:
dic_words[word]=1
else:
dic_words[word]+=1
min_value = min(dic_words.values())
for word in words:
if dic_words[word]>min_value:
new_words+=word
print(new_words)
except:
break
读懂题意很重要,读错了两次。
- dictionary 的用法 min(dic_words.values())可以得到value最小值
- 字符串用法