16 lines
292 B
Python
Executable File
16 lines
292 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import sys
|
|
import re
|
|
|
|
sciezki = {0:{'0':1,'1':0},1:{'0':2,'1':1},2:{'0':1,'1':2}};
|
|
stanyakceptujace = [0,2];
|
|
for input in sys.stdin.readlines():
|
|
act = 0;
|
|
for char in input[:-1]:
|
|
act = sciezki[act][char]
|
|
if act in stanyakceptujace:
|
|
print("YES")
|
|
else:
|
|
print("NO")
|