#C1576. Spam Email Checker

    ID: 44796 Type: Default 1000ms 256MiB

Spam Email Checker

Spam Email Checker

In this problem, you are given an email message and a list of spam words. The task is to determine whether the email is spam. An email is considered spam if it contains at least one word that exactly matches any of the provided spam words.

For example, if the email is you have won a lottery and the list of spam words is ["lottery", "prize", "winner"], then the email should be classified as Spam.

The matching is based on a simple split of the email by whitespace. Formally, let the email be represented as a sequence of words \( e_1, e_2, \dots, e_m \) and let the list of spam words be \( s_1, s_2, \dots, s_n \). If there exists at least one index \( i \) and one index \( j \) such that \( e_i = s_j \), then the email is spam; otherwise, it is not spam.

inputFormat

The input is provided via stdin and consists of multiple lines:

  1. The first line contains the email text (a string).
  2. The second line contains an integer n — the number of spam words.
  3. The next n lines each contain a spam word (a string).

outputFormat

Output a single line to stdout containing either Spam if any word in the email exactly matches one of the spam words, or Not Spam if no such match is found.

## sample
you have won a lottery
3
lottery
prize
winner
Spam

</p>