After being promoted from "Friend Finder" to "Chat Moderator" through nepotism, Mr. DeMello struggles to keep his chat logs civil.
Currently, he has a list of
Specifically, he wants to know the number of distinct banned words in each message.
Given that he also needs to teach, Mr. DeMello cannot make this program himself, so he assigns you to do it (as the diligent student you are).
Can you help him?
Constraints
Note:
Each message and banned word will be only made of uppercase and lowercase letters.
It is also guaranteed that each banned word is distinct.
For all subtasks:
Subtask 1 [10%]
Subtask 2 [90%]
No additional constraints.
Input Specification
The first line will contain
The next
The next
Note: Fast I/O might be required to fully solve this problem (e.g., BufferedReader for Java).
Output Specification
Output the number of distinct banned words for each of the
Sample Input
3 2
dO
kevInyAng
Zain
MaxIsGoingToFindZain
DoKevinyangIsKevinyang
Sample Output
1
2
Explanation for Sample Output
The first message only contains the last banned word: Zain
. The second message contains the first and second banned words: dO
and kevInyAng
. Note that the casing is irrelevant.
Comments