djfz-2023-s464933/TaskG03/run.py
2024-01-29 23:18:03 +01:00

17 lines
404 B
Python

import re2
import sys
def load_surnames(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
return [line.strip() for line in file]
polish_surnames = load_surnames('nazwiska.txt')
setting = re2.Options()
setting.max_mem = 1 << 30
pattern = re2.compile('|'.join(polish_surnames), setting)
for line in sys.stdin:
if pattern.search(line.lower()):
print(line.strip())