728x90
9771번: Word Searching
The first line contains a single word to search. A word contains at most 20 characters. The next line and the rest is a text to search for that word. The text can contain up to 100 lines including blank lines. No line exceeds 250 characters. A word cannot
www.acmicpc.net
문제 풀이
EOF가 입력될 때 까지 입력값을 받으며, 입력값 중 특정한 문자가 발견된다면 그 문자가 발견된 횟수를 출력해준다.
정답 코드
s = input()
cnt = 0
try :
while True :
lst = input().split()
for i in lst :
if s in i : cnt += 1
except :
print(cnt)
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 9776 - Max Volume [python] (0) | 2023.03.27 |
---|---|
[BOJ/백준] 9773 - ID Key [python] (0) | 2023.03.27 |
[BOJ/백준] 9724 - Perfect Cube [python] (0) | 2023.03.27 |
[BOJ/백준] 9723 - Right Triangle [python] (0) | 2023.03.27 |
[BOJ/백준] 9713 - Sum of Odd Sequence [python] (0) | 2023.03.27 |