[BOJ 9771] Word Searching

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Write a program to count the occurrences of a particular word in a given text i.e. how many times does a particular word appear in a text?

입력 형식

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 be separated in different lines i.e. a whole word must appear in the same line. However, a word can appear as a part of a longer word.

출력 형식

Print out the number of occurrences of the word to search. This is a case-sensitive search.

예제 입력

word
Write a program to count the occurrences
of a particular word in a given text
i.e. how many times does a particular
word appear in a text? This Word is not counted
but wording is counted.

예제 출력

3

Comments

There are no comments at the moment.