forked from ayusharma/Hackerrank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext_wrap.py
36 lines (28 loc) · 783 Bytes
/
text_wrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Textwrap
The textwrap module provides two convenience functions, wrap() and fill().
textwrap.wrap()
Wraps the single paragraph in text (a string) so every line is at most width characters long.
Returns a list of output lines.
>>> import textwrap
>>> string = "This is a very very very very very long string."
>>> print textwrap.wrap(string,8)
['This is', 'a very', 'very', 'very', 'very', 'very', 'long', 'string.']
textwrap.fill()
Wraps the single paragraph in text, and returns a single string containing the wrapped paragraph.
>>> import textwrap
>>> string = "This is a very very very very very long string."
>>> print textwrap.fill(string,8)
This is
a very
very
very
very
very
long
string.
"""
import textwrap
a = raw_input()
b = input()
print textwrap.fill(a,b)