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

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

https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9

#-*- coding:utf-8 -*-

string = raw_input()
table = {}
for str in string:
	table[str] = table.get(str, 0) + 1

my_dict = {key: value for key, value in table.items() if value != min(table.values())}

output_list = ''
str_list = list(my_dict.keys())
for s in list(string):
	if s in str_list:
		output_list += s

print(output_list)

#每日靠近华为offer一步#
全部评论

相关推荐

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