编写一个程序,匹配字符串中的形如AABBCC的子串,并将其替换为ABC.,如对于原始字符串s="hello, big big red red hat hat you know small small green green cat cat"被替换后得到的字符串为"hello, big red hat you know small green cat"、
上课这么教的,但是是错的
s="hello, big big red red hat hat you know small small green green cat cat"
import re
re.sub(r'(\b\w+)\1',r'\1',s)