题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
#遍历字符串之后去重,存入字典,找出最小的value对应的key值输出 while True: try: str1 = input() list1 = [] dict1 = {} for i in str1: list1.append(i) list1 = list(set(list1)) dict1[i] = str1.count(i) for k, v in dict1.items(): if v == min(dict1.values()): str1 = str1.replace(k,'') print(str1) except: break