haju__log

[python][SWEA][D3] 1213. [S/W 문제해결 기본] 3일차 - String 본문

SWEA

[python][SWEA][D3] 1213. [S/W 문제해결 기본] 3일차 - String

haju 2023. 5. 8. 11:28

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&problemLevel=3&contestProbId=AV14P0c6AAUCFAYi&categoryId=AV14P0c6AAUCFAYi&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=PYTHON&select-1=3&pageSize=10&pageIndex=3 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

for i in range(10):
    index=int(input())
    find=input()
    str=input()
    result=0
    for i in range(len(str)):
        if str[i] == find[0]:
            if str[i:i+len(find)] == find:
                result+=1

    print("#%d %d" %(index,result))