HCI '16 - Sentence Checker

View as PDF

Submit solution

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

Authors:
Problem type

Patrick is really bad at constructing grammatically 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 program 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 Specification

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 characters, and will not contain any whitespace or punctuation.

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

Output Specification

Output Correct if all words in the sentence can be found in the dictionary. Otherwise, output Incorrect.

Constraints

Subtask 1 [100%]

1 \le N \le 500

Each word will be at most 50 characters long.

The sentence will be at most 100\,000 characters long.

Subtask 2 [0%]

Sample test cases.

Sample Input 1

8
all
my
friends
are
heathens
take
it
slow
all my friends are heathens take it slow

Sample Output 1

Correct

Sample Input 2

7
konnichiwa
hai
watashi
shioutengai
anata
desu
oyasuminasai
konnichiwa watashi anata shioutengai desu hai iie

Sample Output 2

Incorrect

Comments

There are no comments at the moment.