Company: IBM application developer - cloud full stack_16march
Difficulty: easy
Spam Text Classification You are given n text strings and a dictionary of k spam words . Split a text into words at spaces — every maximal run of letters between spaces is one word, and runs of consecutive spaces simply produce no extra words. A word is a spam hit when it is equal to some entry of the dictionary, ignoring letter case . Label each text: spam — the text contains at least 2 spam hits; not_spam — the text contains fewer than 2 spam hits. Every hit is counted separately. If the same spam word appears three times in a text, that is three hits, not one. Only whole words count: a word that merely contains a dictionary entry (or is contained in one) is not a hit. Input Format Line 1: an integer n , the number of texts. The next n lines: texts[0] … texts[n-1] , one text per line, taken verbatim . A text may begin with, end with, or contain runs of spaces, and those spaces are part of the line. The next line: an integer k , the number of spam words. The next k lines: spamWords[0]