44 lines
771 B
Python
44 lines
771 B
Python
import re
|
|
import sys
|
|
|
|
def check(pin):
|
|
pattern = r'^\d{6}$'
|
|
|
|
if re.match(pattern, pin) :
|
|
return True
|
|
else:
|
|
return False
|
|
|
|
def check0(pin):
|
|
k = 0
|
|
a = r'^0'
|
|
b = r'^.{1}0'
|
|
c = r'^.{2}0'
|
|
d = r'^.{3}0'
|
|
e = r'^.{4}0'
|
|
f = r'^.{5}0'
|
|
|
|
|
|
if re.match(a, pin) :
|
|
k+=1
|
|
if re.match(b, pin) :
|
|
k+=1
|
|
if re.match(c, pin) :
|
|
k+=1
|
|
if re.match(d, pin) :
|
|
k+=1
|
|
if re.match(e, pin) :
|
|
k+=1
|
|
if re.match(f, pin) :
|
|
k+=1
|
|
if k<2:
|
|
return True
|
|
else:
|
|
return False
|
|
|
|
for line in sys.stdin:
|
|
number = line.strip()
|
|
if check(number) and check0(number):
|
|
print("yes")
|
|
else:
|
|
print("no") |