티스토리 뷰

728x90

https://www.acmicpc.net/problem/16916

 

16916번: 부분 문자열

첫째 줄에 문자열 S, 둘째 줄에 문자열 P가 주어진다. 두 문자열은 빈 문자열이 아니며, 길이는 100만을 넘지 않는다. 또, 알파벳 소문자로만 이루어져 있다.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
import sys
import re
= sys.stdin.readline().rstrip()
= sys.stdin.readline().rstrip()
pattern = re.compile(P)
if pattern.search(S):
    print(1)
else:
    print(0)
cs

댓글