import re def substitute(file_path): def replace(match): return ''.join(chr(ord('a') + int(digit)) for digit in match.group(0)) with open(file_path, 'r', encoding='utf-8') as file: for line in file: substituted_line = re.sub(r'\b\d{4}\b', replace, line.strip()) print(substituted_line) file_path = 'TaskF00/simple.in' substitute(file_path)