What Kind of Code Is This..
Time limit0.5sMemory limit1024 MB
Given a string with at most two double quotes, print the text between the quotes if it is a valid quoted string, or print CE otherwise.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Toka was confident writing Python code that prints a string. One day she was asked to print Hello, World!. She wrote the code with confidence, but she forgot the double quotes and got a compile error!!

Toka's code that produced the compile error
The error made her lose confidence, so she now avoids printing strings. You want to restore her confidence by writing a program that reads a string and decides whether it is a correct string. A correct string starts and ends with a double quote, and contains at least one character other than the double quotes between them. For example, "Hello, World!" is correct. Strings such as Dijkstra or A"b are not correct, because they do not start or end with a double quote. Write the program that checks Toka's string.
Input
The first line contains Toka's string . has at most 50 characters and consists of English letters, double quotes, and spaces. The string contains at most 2 double quotes in total. The string has no spaces right inside the double quotes, and it has no spaces at its start or end.
Output
If Toka's string is a correct string, print the text between the double quotes. If it is not a correct string, or if the text between the double quotes is empty, print CE.