백준 1543 python [문서 검색]

인지용·2025년 1월 29일
0

알고리즘

목록 보기
31/46
post-thumbnail

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 라는 아주 좋은 함수가 있다.

이걸 이용하면 아주 간단하게 풀 수 있다.

profile
한-줄

0개의 댓글