LearnPy Hub
← Input problems
Medium

Wrap Text to a Width

Read a width w and a line of words. Print the words on as few lines as possible so no line is longer than w characters (words separated by one space; every word is at most w long).

Input

w, then one line.

Output

Lines.

Sample 1

Input
10
the quick brown fox jumps
Output
the quick
brown fox
jumps

Sample 2

Input
5
a b c d e f
Output
a b c
d e f
solution.py
Output appears here
Wrap Text to a Width · Python practice problem · LearnPy Hub