forked from miczar1/djfz-24_25
Solve TaskC03
This commit is contained in:
parent
adab123343
commit
8bb69f7cf5
13
TaskC03/solution.py
Normal file
13
TaskC03/solution.py
Normal file
@ -0,0 +1,13 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
def is_valid_nip(line: str) -> bool:
|
||||
# matching either:
|
||||
# xxx-xxx-xx-xx OR xxx-xx-xx-xxx
|
||||
p = re.compile(r'^(?:\d{3}-\d{3}-\d{2}-\d{2}|\d{3}-\d{2}-\d{2}-\d{3})$')
|
||||
return bool(p.match(line))
|
||||
|
||||
if __name__ == "__main__":
|
||||
for line in sys.stdin:
|
||||
stripped_line = line.strip()
|
||||
print("yes" if is_valid_nip(stripped_line) else "no")
|
5
TaskC03/test.out
Normal file
5
TaskC03/test.out
Normal file
@ -0,0 +1,5 @@
|
||||
yes
|
||||
yes
|
||||
yes
|
||||
no
|
||||
no
|
Loading…
Reference in New Issue
Block a user