You must take input in the form of
title|line1|line2|(...)|line[n]
And output an information card. It's hard to explain how to make the card, so here's a quick example:
Input
1234567890|12345|1234567890123|pie|potato|unicorn
Output
/===============\
| 1234567890 |
|===============|
| 12345 |
| 1234567890123 |
| pie |
| potato |
| unicorn |
\---------------/
Detailed specifications:
- The title must be centered (if there are an odd number of characters you can decide whether to put an extra space after or before it).
- The remaining lines must be left-aligned.
- All of them must have at least one space of padding before and after.
- Each line must be the same length.
- The lines must be the smallest length possible in order to fit all of the text.
- The first and last character of each row (except for the first and last rows) must be a
|
. - There must be a
/
, a row of=
s, and a\
in the line right before the title. (the first line) - There must be a
|
, a row of=
s. and a|
in the line right after the title. (the third line) - There must be a
\
, a row of-
s, and a/
in the last line. - For the example input provided, your program's output must exactly match the example output provided.
- The input will always contain at least one
|
; your programs behaivior when a string likebadstring
is input does not matter.
This is code-golf so the shortest code in character count wins.
input()
interprets the input as python code. Is it ok to use input and take the input in quotes, if so do we need to add 2 for the quotes? \$\endgroup\$