jfz-2023-s473564/TaskF04/run.py

23 lines
543 B
Python
Raw Permalink Normal View History

2024-01-19 15:20:29 +01:00
import re
def delete_second_digits(input_line):
regex = r'\b(\d+)\b'
numbers = re.findall(regex, input_line)
if len(numbers) > 1:
second_number = numbers[1]
input_line = re.sub(re.escape(second_number), '', input_line, 1)
return input_line
file_path = 'simple.in'
output_lines = []
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
modified_line = delete_second_digits(line)
output_lines.append(modified_line)
for line in output_lines:
print(line, end='')