[BOJ 6550] 부분 문자열

이현영·2023년 2월 15일

백준

목록 보기
2/2
import sys
input = sys.stdin.readline


def find(s, t):
    i = 0
    for char in t:
        if char == s[i]:
                i += 1
        if i == len(s):
            return "Yes"
    return "No"


while True:
    try:
        line = input()
        s, t = line.split()
        print(find(s, t))

    except:
        break

📝 임의의 여러 줄 입력받기
1️⃣ while True 로 계속 입력받기
2️⃣ try exept 문을 while 문 안에 넣어 예외처리

profile
티스토리로 이전했습니다 | https://hamo0.tistory.com/

0개의 댓글