20 lines
581 B
Python
20 lines
581 B
Python
![]() |
import re
|
||
|
|
||
|
def pattern(file_path):
|
||
|
pattern = r'^[a-zA-ZąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+(!+|1|one|eleven)+$'
|
||
|
one_eleven_pattern = r'(1|one|eleven)'
|
||
|
|
||
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||
|
for line in file:
|
||
|
line = line.strip()
|
||
|
if re.match(pattern, line):
|
||
|
if line.count('!') >= 2 and re.search(one_eleven_pattern, line):
|
||
|
print('yes')
|
||
|
else:
|
||
|
print('no')
|
||
|
else:
|
||
|
print('no')
|
||
|
|
||
|
|
||
|
file_path = 'TaskE43/test.in'
|
||
|
pattern(file_path)
|