单词和出现次数存入哈希表 -> 查找最小出现值 -> 查找相同次数单词 -> 删除
while True:
try:
strings = input().strip()
temp = {}
for i in strings:
if temp.get(i):
temp[i] += 1
else:
temp[i] = 1
cnt = min(list(temp.values()))
print('cnt:', cnt)
print(temp)
for key, val in temp.items():
if val == cnt:
strings = strings.replace(key, '')
print(strings)
except:
break

京公网安备 11010502036488号