forked from miczar1/djfz-24_25
18 lines
683 B
Python
18 lines
683 B
Python
|
import re
|
||
|
import sys
|
||
|
|
||
|
def is_pokemon(line: str) -> bool:
|
||
|
# Defining lowercase and uppercase sets, with Polish diacritic letters included.
|
||
|
lowercase = "a-ząćęłńóśźż"
|
||
|
uppercase = "A-ZĄĆĘŁŃÓŚŹŻ"
|
||
|
|
||
|
# Note: I tried to use a single regex pattern as requested.
|
||
|
# It turned to be kinda complicated! It relies on preventing identical cases appearing in a row, thus switching case.
|
||
|
p = re.compile(fr'^([{uppercase}]?(?:[{lowercase}][{uppercase}])+[{lowercase}]?)')
|
||
|
return bool(p.match(line))
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
for line in sys.stdin:
|
||
|
stripped_line = line.strip()
|
||
|
print("yes" if is_pokemon(stripped_line) else "no")
|