#P10006. 文字排版

文字排版

题目描述

给一段英文短文,单词之间以空格分隔(每个单词包括其前后紧邻的标点符号,可能单词之间不止一个空格)。请将短文重新排版,具体要求如下:

  1. 每行 不超过 KK 个字符;
  2. 每个单词居于同一行上;
  3. 在同一行的单词之间以一个空格分隔;
  4. 行首和行尾都没有空格(判分时会严格检查);
  5. 排版后短文末尾不能有空行(判分时会严格检查)。

输入格式

11 行是一个正整数 KK,第 22 行是一段短文,文中只有英文字母、英文标点符号和空格,英文标点符号只会出现在单词的末尾。

输出格式

多行,就是按要求排版后的短文。

输入输出样例

输入样例1

80
One sweltering day, I was scooping ice cream into cones and told my four children they could "buy" a cone from me for a hug. Almost immediately, the kids lined up to make their purchases. The three youngest each gave me a quick hug, grabbed their cones and raced back outside. But when my teenage son at the end of the line finally got his turn to "buy" his ice cream, he gave me two hugs. "Keep the changes," he said with a smile.

输出样例1

One sweltering day, I was scooping ice cream into cones and told my four
children they could "buy" a cone from me for a hug. Almost immediately, the kids
lined up to make their purchases. The three youngest each gave me a quick hug,
grabbed their cones and raced back outside. But when my teenage son at the end
of the line finally got his turn to "buy" his ice cream, he gave me two hugs.
"Keep the changes," he said with a smile.

说明/提示

👀️ 对于100%100\% 的数据,1K1001 \leq K \leq 100,短文中单词数量不会超过 1000010000,每个单词长度不超过 4040