#CCBCHBON0000039. Tách mỗi từ ra một dòng (One Word Per Line)

Tách mỗi từ ra một dòng (One Word Per Line)

One Word Per Line

Source: Kernighan & Ritchie

Version: Phuoc Hung OJ Extended

Problem Statement

A word is a maximal run of characters excluding only space, horizontal tab and newline. Print each word intact on its own line, terminated by newline. Consecutive/leading/trailing separators produce no blank lines. Punctuation belongs to words.

Input

UTF-8 stream of at most 100000 bytes, no CR; it may be empty or unterminated.

Output

One word per line with newline after each word, or empty output if there are no words.

Subtasks

  • Subtask 1 (20%): UTF-8 stream length at most 100 bytes, no CR.

  • Subtask 2 (30%): UTF-8 stream length at most 2000 bytes, no CR.

  • Subtask 3 (50%): UTF-8 stream length at most 100000 bytes, no CR.

Examples

Example 1

Input:

  abc	def  ghi

Output:

abc
def
ghi

Explanation:

The three separator types end words without producing empty output lines. Actual escaped input: " abc\tdef ghi\n"; escaped output: "abc\ndef\nghi\n".

Example 2

Input:


 	 

Output:


Explanation:

The three separator types end words without producing empty output lines. Actual escaped input: "\n \t "; escaped output: "".

Example 3

Input:

hello

Output:

hello

Explanation:

The three separator types end words without producing empty output lines. Actual escaped input: "hello"; escaped output: "hello\n".

The quoted forms below use \t for a literal tab, \n for an LF, and \ for a literal backslash; they describe the actual byte stream, not additional characters in input.