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 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 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 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 Format

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 Testcases

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


  • -1
    vO_Ov  commented on May 6, 2020, 9:58 a.m.

    I dont know why my submission is graded as WA it passes all the cases.


    • 3
      Kirito  commented on May 6, 2020, 1:49 p.m.

      Because it doesn't pass the last case?


  • 4
    HARRIBO  commented on Aug. 31, 2019, 1:16 a.m.

    Oof I programmed the whole thing in Python.


  • 1
    jlsajfj  commented on May 31, 2019, 12:05 p.m.

    Why's python disabled


    • 1
      Beautiful_Times  commented on May 31, 2019, 2:07 p.m.

      This was from a contest where only C and C++ was allowed.


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

    This comment is hidden due to too much negative feedback. Click here to view it.