python字符串练习:输入一个字符串,将其中多个重复字母替换成&。
用正则,望采纳!谢谢
import re data = input() re.sub(r"(.)\1+", r"&", data)