import re def check_phone(file_path): pattern = r'^555(-\d{3}-\d{3}$|\s\d{3}\s\d{3}$)' with open(file_path, 'r', encoding='utf-8') as file: for line in file: if re.match(pattern, line.strip()): print('yes') else: print('no') file_path = 'TaskE04/test.in' check_phone(file_path)