LearnPy Hub
← Input problems
Hard

Draw a Table With Borders

Read n rows of comma-separated values (the first row is the header; every row has the same number of fields). Print a table with +---+ borders, a border under the header, and every column as wide as its longest value plus one space on each side. Values are left-aligned.

Input

n, then n lines.

Output

Several lines.

Sample 1

Input
3
name,marks
Mim,90
Rafi,85
Output
+------+-------+
| name | marks |
+------+-------+
| Mim  | 90    |
| Rafi | 85    |
+------+-------+

Sample 2

Input
1
only
Output
+------+
| only |
+------+
+------+
solution.py
Output appears here
Draw a Table With Borders · Python practice problem · LearnPy Hub