题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
import sys for line in sys.stdin: s=line.strip() sli=list(s) sdic=dict() for i in sli: if i in sdic.keys(): sdic[i]+=1 else: sdic[i]=1 vcount=list(sdic.values()) vcount.sort() vmin=vcount[0] rvalue=[] for key,val in sdic.items(): if val==vmin: rvalue.append(key) for i in rvalue: while True: if i in sli: sli.remove(i) else: break print(''.join(sli))