import re import sys for line in sys.stdin: line = re.sub(r'(\D*)([0-9]+)(\D+)([0-9]+)(.*)', r'\1\2\3\5', line, 1) sys.stdout.write(line)