djfz-2020-s444399/TaskE08/run
Kijowski Michał 025c3633e7 fdgg
2020-12-11 00:33:32 +01:00

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")