jfz-2023-s473564/TaskF05/run.py
2024-01-19 15:20:29 +01:00

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='')