#C9818. Convincing Phrase Checker

    ID: 53953 Type: Default 1000ms 256MiB

Convincing Phrase Checker

Convincing Phrase Checker

You are given a set of phrases and your task is to determine if each phrase is "Convincing" based on the following criteria:

  • The phrase must contain at least one of the keywords: urgent, emergency, help, or immediate.
  • The total number of exclamation marks (!) in the phrase must be at most 3, i.e. \(\#\{!\} \leq 3\).
  • The phrase must not have any sequence of three or more identical consecutive characters, i.e. for any character \(c\), it must not appear as \(ccc\) or longer consecutively.

If all these conditions are met, the phrase is considered "Convincing"; otherwise, it is "Not Convincing".

Input/Output Format: The program reads from standard input and writes to standard output.

inputFormat

The input begins with an integer \(n\) (\(1 \leq n \leq 10^5\)) indicating the number of phrases. This is followed by \(n\) lines, each containing a phrase.

Each phrase is a non-empty string that may contain spaces and punctuation.

outputFormat

Output \(n\) lines. For each phrase, output either Convincing if the phrase meets all the criteria or Not Convincing otherwise.

## sample
6
This is an urgent request! Please respond immediately!!
We need help!!! This is an emergency!
Please respond as soon as possible!
immediate help needed! Now!!
AAAAThis is urgent!
This needs immediate attention!!
Convincing

Not Convincing Not Convincing Convincing Not Convincing Convincing

</p>