16 lines
427 B
Python
16 lines
427 B
Python
import re
|
|
|
|
def process_line(line):
|
|
words = re.findall(r'\w+', line)
|
|
if len(words) >= 3:
|
|
third_word = words[2]
|
|
replacement = 'x' * len(third_word)
|
|
line = re.sub(r'\b' + re.escape(third_word) + r'\b', replacement, line)
|
|
|
|
return line
|
|
|
|
with open('simple.in', 'r', encoding='utf-8') as file:
|
|
for line in file:
|
|
processed_line = process_line(line)
|
|
print(processed_line, end='')
|