406081: GYM102263 C Check The Text
Description
Roze has a special keyboard which consists only of 29 keys:
-26 alphabetic a-z keys, which prints the 26 lowercase Latin letters.
-"Space" key, which prints a single space.
-"CapsLock" key, which converts the status of the letters keys from lowercase to uppercase and vice versa. The status initially is lowercase.
-"Backspace" key, which deletes the last letter/space that was written on the screen.
If Roze presses "Backspace" and there is nothing to delete on the screen, nothing will happen.
Given the text that Roze had to print and the order of the keys she has pressed on the keyboard, check if Roze has printed the text correctly (including exactly one space between every two words).
InputThe first line contains an integer $$$n$$$ ($$$1 < n < 2000$$$), which is the number of the words in the text Roze has to print.
Then n strings represent the text Roze has to print separated by exactly one space.
Each string consists only of uppercase and lowercase Latin letters, and the total length of all strings less than 2000
The following line contains an integer $$$m$$$ ($$$1 < m < 2000$$$), which is the number of the keys Roze has pressed.
Then m lines, each line contains a string that represents the key was pressed.
It's guaranteed that the last key pressed is a letter and the first key is not a space key.
OutputPrint a single line containing the result of checking.
If Roze has printed the text correctly, print "Correct". Otherwise, print "Incorrect".
ExampleInput2 Hello World 18 CapsLock h CapsLock e l l Backspace o Space w o Backspace Backspace w o r l dOutput
Incorrect