https://www.acmicpc.net/problem/1543
import sys
# with open("./data.txt", "r") as file:
# def input():
# return file.readline()
def input():
return sys.stdin.readline().strip()
str = input()
targetStr = input()
print(str.count(targetStr))
파이썬에 count 라는 아주 좋은 함수가 있다.
이걸 이용하면 아주 간단하게 풀 수 있다.