
[Baekjoon] 1013. Contact
·
코딩테스트/Python
🔗 Problem Linkhttps://www.acmicpc.net/problem/1013❔Thinking주어진 패턴 "(100+1+ | 01)+"과 일치하는 문자열인 경우 "YES", 아니라면 "NO"를 반환한다.💻Solutionimport reimport sysinput = sys.stdin.readlineT = int(input().rstrip())r = re.compile("(100+1+|01)+")for _ in range(T): pattern = input().rstrip() if r.fullmatch(pattern): print('YES') else: print('NO')🗝️keypointre로 compile하면, r을 해당 패턴을 검색하는데 활..