import re import sys def replace_digits_with_letters(input_string): digit_to_letter = {'0': 'a', '1': 'b', '2': 'c', '3': 'd', '4': 'e', '5': 'f', '6': 'g', '7': 'h', '8': 'i', '9': 'j'} def replace(match): number = match.group() replaced_number = ''.join(digit_to_letter[digit] for digit in number) return replaced_number pattern = re.compile(r'\b\d{4}\b|\d{4}') result = pattern.sub(replace, input_string) return result def write_answer(row, ouput_file): with open(ouput_file, "a", encoding="utf-8") as file: file.write(row) def main_function(input_file, output_file): with open(output_file, "w", encoding="utf-8") as output_file1: with open(input_file, "r", encoding="utf-8") as file: for row in file: write_answer(replace_digits_with_letters(row), output_file) # output_file ='simple.out' # input_file = 'simple.in' input_file = sys.argv[1] output_file = sys.argv[2] main_function(input_file, output_file)