djfz-2023-s473575/TaskF00/run.py

16 lines
458 B
Python

import re
import sys
def num_to_lett(match):
word = match.group(0)
letters = []
dict_mapping = {0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8: 'i', 9: 'j'}
numbers = list(word)
for number in numbers:
letters.append(dict_mapping[int(number)])
new_word = ''.join(letters)
return new_word
for line in sys.stdin:
modified_line = re.sub(r'[0-9]{4}', num_to_lett, line)
print(modified_line.strip())