import re def find_names_with_3_digit_area_code(file_path): # Define the regular expression pattern pattern = re.compile(r"(\w+)\s(\d{3}-\d{8})") # List to store names with 3-digit area code names_with_3_digit_area_code = [] # Read the input file with open(file_path, 'r') as file: for line in file: match = pattern.match(line) if match: name = match.group(1) names_with_3_digit_area_code.append(name) return names_with_3_digit_area_code # Example usage file_path = 'input.txt' names = find_names_with_3_digit_area_code(file_path) print("Names with 3-digit area code phone numbers:", names)