#C11707. Spelling Checker
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:
- The first line contains a string representing the target word \(T\).
- The second line contains an integer \(n\), representing the number of words.
- 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.
## sampleapple
5
orange
banana
grape
apple
peach
Incorrect
Incorrect
Incorrect
Correct
</p>