Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- HTML
- 정렬
- 스택
- 오픽
- 11066
- 브루트포스
- 오늘의 계획
- ENFJ
- 코딩
- 12969
- 웹 페이지 입문
- DP
- 정규 표현식 #문자열
- Greedy
- Python
- 더하기 시리즈
- 백준풀이
- 2
- 구현
- 컴공
- DFS
- 수 정렬하기2
- 다이나믹 프로그래밍
- 1
- BFS
- 백트래킹
- knuth_optimization
- 파이썬
- 백준
- 3
Archives
- Today
- Total
코딩하는 Fug
1013 contact 본문
#1013 contact
'''
(100+1+ l 01)+
1로 시작하면 0 2개 이상 다음 1 1개 이상 그후에
1을 쭉 지우다가 뒤에 0이 2개 이상인게 나오면 while 처음으로
# 0을 다 지웠는데 str이 안 남아 있으면 false 뒤에 100임을 확인하기 위해 미리 지워놔야 인덱스 오류가 안남
0으로 시작하면 다음 1무조건
0으로 시작하고 다음 1 이면 01 없애기
'''
for t in range(int(input())):
answer_str = input()
tmp_len=0
while len(answer_str) and tmp_len!=len(answer_str):
tmp_len=len(answer_str)
if answer_str[0:3]=='100':
answer_str=answer_str[3:]
while len(answer_str)>0 and answer_str[0]=='0':
answer_str=answer_str[1:]
if len(answer_str)==0:
answer_str='1'
break
answer_str=answer_str[1:]
while len(answer_str)>0 and answer_str[0]=='1':
if len(answer_str)>=3 and answer_str[1]=='0' and answer_str[2]=='0':
break
else:
answer_str=answer_str[1:]
elif answer_str[0:2]=='01':
answer_str=answer_str[2:]
if len(answer_str):
print("NO")
else:
print("YES")