SAC '22 Code Challenge 3 P5 - Chat Corrections
View as PDFAfter 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  banned words, 
, and wants to check his 
 assigned messages for them.
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:  denotes the length of string 
, and the banned words and messages are case insensitive.
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  and 
, the number of banned words and the number of messages.
The next  lines will contain 
, the 
 banned word.
The next  lines will contain 
, the 
 message to check.
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  messages.
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