CBOJ 2022 Spring Contest Problem 1 - KMP


Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Alice runs a string-converting business, using a machine known as a KMP. Customers hand Alice a space-separated sequence of words, and Alice hands them back a new string, but with each word on its own line, followed by an empty new line. In essence, the KMP converts every space character into a \n character.

Unfortunately, Alice’s machine is old, and suddenly stopped working. As her business must continue to run, she asks you to write a program that can emulate the KMP.

This problem uses an Identical checker. Please follow the Output Specification carefully.

Input Specification

The first line will contain one string: a sequence of words separated by spaces. This string contains at least \(2\) characters and at most \(2\times 10^5\) characters. There will be no more than two spaces in a row, the first character will not be a space, and the last character will not be a space.

Output Specification

Output each word from the original string on its own line. Then, output a new line (the \n character). Not doing so can result in the Presentation Error verdict.

Sample Input 1

The quick brown fox jumps over the lazy dog.

Sample Output 1

The
quick
brown
fox
jumps
over
the
lazy
dog.

Sample Input 2

THIS PROBL#M DOES N!OT USE KMP! !

Sample Output 2

THIS
PROBL#M
DOES
N!OT
USE
KMP!
!

Comments

There are no comments at the moment.