Text Wrap ⬀
You are given a string S and width w.
Your task is to wrap the string into a paragraph of width w.
Complete the wrap function in the editor below.
wrap has the following parameters:
string string: a long stringint max_width: the width to wrap to
string: a single string with newline characters ('\n') where the breaks should be
- The first line contains a string,
S. - The second line contains the width,
max_width.
0 < len(string) < 10000 < max_width < len(string)
ABCDEFGHIJKLIMNOQRSTUVWXYZ
4
ABCD
EFGH
IJKL
IMNO
QRST
UVWX
YZ