16 lines
367 B
Python
16 lines
367 B
Python
import re
|
|
import sys
|
|
|
|
|
|
def substitute(m):
|
|
string = re.sub(r".", "x", m.group(3))
|
|
return re.sub(r"(\W*\w+\b\W*)(\w+\b\W*)(\w+)(.*)", r"\1\2"+string+r"\4", m.group(0))
|
|
|
|
|
|
for line in sys.stdin:
|
|
match = re.search(r"(\W*\w+\b\W*)(\w+\b\W*)(\w+)(.*)", line)
|
|
if match:
|
|
print(substitute(match).rstrip("\n"))
|
|
else:
|
|
print(line.rstrip("\n"))
|