A printer prints a sentence that ends in a punctuation mark in a monospaced font (a font whose characters each occupy the same amount of horizontal space). It inserts a space after the concluding punctuation mark and then prints the same sentence again. It continues in this way until it has filled the page, running the sentences together into one long paragraph.
In case the sentence is shorter than a full line and no words are hyphenated, it can be proven that the paragraph will always include a full column of blank spaces. The latter follows from the observation that each new line presents the complete sentence in some order before any part of the sentence gets repeated. Hence, there will always be a column of spaces following the first sentence. Probably it was T. Robert Scott who first discovered this phenomenon of the blank column.
There are two lines of input. The first line contains a sentence that ends with a punctuation mark. There is no whitespace at the start and at the end of the sentence, and in between consecutive words there's a single space. The second line contains an integer $$n \in \mathbb{N}$$ that indicates the maximal number of characters that can be printed on a single line. You may assume that the length of all words in the given sentence is less than $$n$$.
The output contains a paragraph that is generated by repeatedly printing the given sentence. There is a single space in between two repetitions of the sentence. At most $$n$$ characters can be printed on a single line, but each line should also contain as many words of the paragraph. The text on a line can only be broken at a position containg a space, and that space should no longer be printed. As such, a line never ends in a space.
Printing a paragraph can be terminated in two possible ways. Either the paragraph ends if a new repetition of the given sentence would be started on the next line (or in other words: the first word of the next line would correspond to the first word of the sentence). A paragraph also ends if it already consist of ten lines.
Input:
The quick brown fox jumps over the lazy dog.
59
Output:
The quick brown fox jumps over the lazy dog. The quick
brown fox jumps over the lazy dog. The quick brown fox
jumps over the lazy dog. The quick brown fox jumps over the
lazy dog. The quick brown fox jumps over the lazy dog. The
quick brown fox jumps over the lazy dog. The quick brown
fox jumps over the lazy dog. The quick brown fox jumps over
the lazy dog. The quick brown fox jumps over the lazy dog.