13017 - Typing practice   

Description

Although Yazmonkey is expert in debugging, his typing speed is very slow because every time he it concentrated on typing, he can't help but distracted by the flavor of banana milk. He's dream is to become a best programmer in the universe, so he make up his mind to practice his typing speed and the correctness.

The way how Yazmonkey practice is as follow:

He generates a target string that only contains lowercace and upppercase alphabet and space.
After that, he will start typing. He can only type lowercace and upppercase alphabet, space and backspace.

He wants you to write a program to continuously output whether the string he has typed matchs with the prefix of the target string.
At the end, check whether the string he has typed exactly matchs with the target string.

If it matchs correctly, his prize is a carton of banana milk.

hint:
Since the target string may contains space, maybe you need fgets() to input the target string.
Of course using gets() on OJ platform is fine but never use gets() in practice, you can refer to this link for the reason.
The latest revision of the C standard has definitively removed this function from its specification.

Input

First line of the input contains the target string.
Next, each line represents the key Yazmonkey has pressed.
Keep input until Yazmonkey finish typing.
(\b represents backspace)
Guarantee the length of the target string is ≤ 500000 and the number of keys that Yazmonkey will press is ≤ 1000000.

Output

Everytime when Yazmonkey press a key, if the string he has typed so far matchs with the prefix of the target string then output 1, otherwise output 0.

When Yazmonkey finish typing, check whether the string he has typed matches with the target string.
If matches, output "Correct", otherwise output "Incorrect".
Remember to add '\n' at the end of every line.

Sample Input  Download

Sample Output  Download

Tags




Discuss