ReWord-wrap

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

When a window of a text editor resizes, it is often necessary to readjust all of the containing words to fit in the screen window without splitting up any of the words. This is referred to as word-wrapping. Given a block of text, word-wrap the data to fit in a specific size.

입력

The first line of input will contain a single integer n that indicates the number of datasets to follow. Each dataset will consist of:

  • An integer w indicating the number of characters to word wrap, where 10 ≤ w ≤ 50.
  • An integer m indicating the number of lines of text input that are to be word wrapped, where 1 ≤ m ≤ 100.
  • The m lines of text to be word wrapped.

출력

Output the text word wrapped to the proper number of characters, and include one blank line after each dataset.