题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
input = input() # 统计每个字符的出现次数 input = [{'char':item,'num':input.count(item)} for item in input] mincount = len(input) # 找到次数最小的 for item in input: if item['num'] < mincount: mincount = item['num'] # 输出时跳过最小的 for item in input: if item['num'] != mincount: print(item['char'],end='')#删除字符串中出现次数最少的字符#