#C11707. Spelling Checker

    ID: 41053 Type: Default 1000ms 256MiB

Spelling Checker

Spelling Checker

You are given a target word and a list of words. You must check each word in order and output "Incorrect" for each word that does not match the target. When a word exactly matches the target word, output "Correct" and stop processing any further words.

The problem can be formulated mathematically as follows. Let \(T\) be the target word and \(W = [w_1, w_2, \dots, w_n]\) be the list of words. You have to find the smallest index \(k\) such that \(w_k = T\) (if one exists). For all indices \(i < k\), output "Incorrect" and output "Correct" for index \(k\). If no such index exists, then output "Incorrect" for all words.

Note: The checking stops as soon as a correct word is found.

inputFormat

The input is given from standard input (stdin) with the following format:

  1. The first line contains a string representing the target word \(T\).
  2. The second line contains an integer \(n\), representing the number of words.
  3. The following \(n\) lines each contain one word which are the candidates to check.

outputFormat

Print each result on a new line to standard output (stdout). For each word processed, output "Incorrect" until a word that matches the target is found. For the matching word, output "Correct" and terminate processing.

## sample
apple
5
orange
banana
grape
apple
peach
Incorrect

Incorrect Incorrect Correct

</p>