Sentence Checker

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M
Authors:

Problem type

Allowed languages
C , C++

Patrick is really bad at constructing gramatically-correct sentences and using the correct words (from the dictionary, of course) to come up with the sentence. Therefore, his English teacher has decided to make him write a sentence to improve his skills. While he has already completed the sentence (yay, no need to code a programme to write it), he needs you to check whether he has used only the words from the dictionary. As you would not want to sit for hours looking at his work (it's that bad), you decided to code a program to do the task!


Input Format

The first line contains an integer N, representing the number of words in the dictionary.

The next N lines contain strings, one on each line, which are the words in the dictionary. These strings contain only lowercase english alphabets, and will not contain any whitespace or punctuation.

The rest of the input contains a string, the sentence. The sentence contains only lowercase english alphabets possibly separated by whitespace and newlines.

Output Format

Output "Correct" (without quotes) if all words in the sentence can be found in the dictionary. Otherwise, output "Incorrect" (without quotes).

Constraints

Subtask 1(100%): 1 \le N \le 500. Each word will be at most 50 characters long. The sentence will be at most 100000 characters long.

Subtask 2(0%): Sample Testcases

Sample

Input
8
all
my
friends
are
heathens
take
it
slow
all my friends are heathens take it slow
Output
Correct
Input
7
konnichiwa
hai
watashi
shioutengai
anata
desu
oyasuminasai
konnichiwa watashi anata shioutengai desu hai iie
Output
Incorrect

Comments


  • 0
    saltyfeiyang  commented on Dec. 5, 2017, 9:22 p.m.

    I have no clue why, but my code seems to be just not working.


  • -3
    NT_AUTHORITY_SYSTEM  commented on Sept. 8, 2017, 7:11 p.m.

    Input specifications should be a bit precise if the only allowed languages are C/C++. Mention trailing newlines and the sort.


  • -2
    Quality_of_Perfection  commented on Jan. 27, 2017, 10:02 p.m.
    Allowed Languages?

    Can someone please make Java an allowed language for this problem ?