Simon Says
Time limit2sMemory limit256 MB
Print the trailing part of every command that starts with 'Simon says' and skip all other commands.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Kkung, who studies English hard, goes on a university trip and plays Simon Says with the juniors he wants to get along with.
The rules of Simon Says are simple. When someone says "Simon says" and then gives an instruction, everybody does exactly what the instruction says. If Kkung says "Simon says touch your nose", everybody touches their nose. But when Kkung says only "Stop touching your nose", anyone who takes a hand off their nose gets a penalty.
So only an instruction that starts with "Simon says" is followed.
The computer science juniors decide to play the game with a program that never slips. Read the commands in order and pick out the instructions that must be followed.
Input
The first line contains the number of commands N. ()
Each of the next N lines contains one command, and no command is longer than 100 characters.
Commands are case sensitive, words are separated by a single space, and a sentence ends with a period.
Some commands start with "Simon says" and some do not. If a command starts with "Simon says", the word "says" is always followed by a space and at least one more word.
No command starts or ends with a space.
Output
For each command that starts with "Simon says", print the rest of that command after those first 10 characters, one per line, in input order. The rest begins with a space, so print that space too.
Ignore every other command.