import re
string = """
this is is is is is is is is a string
and here is another another another another example
"""
rx = r'((\b\w+\b)\s*\2\s*)+'
string = re.sub(rx, r'\2 ', string)
print string
aW1wb3J0IHJlCgpzdHJpbmcgPSAiIiIKdGhpcyBpcyBpcyBpcyBpcyBpcyBpcyBpcyBpcyBhIHN0cmluZwphbmQgaGVyZSBpcyBhbm90aGVyIGFub3RoZXIgYW5vdGhlciBhbm90aGVyIGV4YW1wbGUKIiIiCnJ4ID0gcicoKFxiXHcrXGIpXHMqXDJccyopKycKCnN0cmluZyA9IHJlLnN1YihyeCwgcidcMiAnLCBzdHJpbmcpCnByaW50IHN0cmluZw==