TikTok Spam Filter
TikTok Content Moderation Team is working to help creators manage their video comments effectively, ensuring a positive environment by identifying spammy behavior in the comments section.
You have a total of n videos and k keywords that you want to monitor for spammy behavior in the comments. The comments are collected in an array called comments, while the keywords that indicate spammy behavior are stored in another array called spam_keywords.
A comment is flagged as spam if it contains at least two instances of the keywords in the spam_keywords array.
Your task is to analyze the comments for each video and return an array of n strings, labeling each comment as either "spam" or "not_spam" based on the presence of the keywords.
Note: If a keyword appears multiple times in a comment, each occurrence counts toward the spam threshold. Also note that, keyword matching should be case-insensitive.
Complete the function getSpamComments in the editor.
getSpamComments takes the following arguments:
- 1.
string comments[n]: an array of strings representing comments on TikTok videos - 2.
string spam_keywords[n]: an array of strings containing keywords that signify spammy behavior
Returns
string[n]: the results of spam detection
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.
- 1 ≤ n ≤ 10^3
- 1 ≤ k ≤ 10^5
- 1 ≤ |comments[i]| ≤ 10^5
- 1 ≤ |spam_keywords[i]| ≤ 10^5
- It is guaranteed that the sentences and search words consist of lowercase and uppercase English letters and spaces only.