SWE(4864)_문자열비교

SWE 4864 문자열비교

코드

T = int(input())

for tc in range(1, T+1):
    str1 = input()
    str2 = input()
    result = 0
    for j in range(len(str2)-len(str1) + 1):
        cnt = 0
        if(str1[0] == str2[j]):
            cnt += 1
            for k in range(1, len(str1)):
                if str1[k] == str2[j+k]:
                    cnt += 1
                if(cnt == len(str1)):
                    result = 1
                    break
    print("#%d %d" % (tc, result))

참고자료

0%