题解 | #万万没想到之聪明的编辑#
import sys
import re
def correct(s):
s = re.sub(r'(\w)\1{2,}', r'\1\1', s) # 2+转2
s = re.sub(r'(\w)\1(\w)\2', r'\1\1\2', s) # AABB转AAB
return s
for line in sys.stdin:
a = line.split()
s = a[0]
if not s.isdigit():
print(correct(s))