Input
You are given a single line of text, with length at most 1000
characters. The text consists of English words. Adjacent words in the
line are separated by a single space.
The second line consists of a single integer ‘N’ denoting the width of
an output line.
Output
Print the input text in the following format:
- no line of output must be more than N characters long.
- no word can be split across two lines. If a word does not
completely fit in a line, move the word to the next line.
Sample Input
O SOFT embalmer of the still midnight Shutting with careful fingers
34
Sample Output
O SOFT embalmer of the still
midnight Shutting with careful
fingers
Explanation
Each output line is at most 34 characters long. “midnight” does not
fit on the first line, hence it was moved to the second
line. “fingers” does not fit on the second line, hence it was moved
to the third line.