LearnPy Hub
← Regular Expressions problems
Hard

Whole Words Only

Read a sentence and a word. Count how many times the word appears as a whole word, ignoring case (so 'cat' doesn't match 'category').

Input

A sentence, then a word.

Output

A count.

Sample 1

Input
The cat sat on the category mat. CAT!
cat
Output
2

Sample 2

Input
the theme of the day
the
Output
2
solution.py
Output appears here
Whole Words Only · Python practice problem · LearnPy Hub