LearnPy Hub
← Introduction & print() problems
Hard

Box Around Several Lines

Read n lines. Print them inside a box: a top and bottom border +---…+, and each line as | text | padded with spaces so all right borders line up with the longest line.

Input

n, then n lines.

Output

n + 2 lines.

Sample 1

Input
3
Hello
LearnPy Hub
Python
Output
+-------------+
| Hello       |
| LearnPy Hub |
| Python      |
+-------------+

Sample 2

Input
1
x
Output
+---+
| x |
+---+
solution.py
Output appears here
Box Around Several Lines · Python practice problem · LearnPy Hub