17 lines
404 B
Python
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())
|