Write a program or function that takes in a nonempty single-line string. You may assume it only contains printable ASCII excluding space.
Print or return an ASCII art lozenge shape similar to a lemon or lime made from the prefixes of the string.
Suppose the input string is n letters long. Then, such a shape consists of 2n − 1 columns of ASCII art stitched together, each consisting of 2n − 1 lines. Counting from 1, the k-th column is f(k) = min(k, 2n − k) characters wide, and contains f(k) copies of the first f(k) characters of input, centered vertically, with single blank lines separating the copies.
For example, if the input is Lemon
, the output should be:
Lemon
Lemo Lemo
Lem Lemon Lem
Le Lemo Lemo Le
L Lem Lemon Lem L
Le Lemo Lemo Le
Lem Lemon Lem
Lemo Lemo
Lemon
If the input is lime
the output should be:
lime
lim lim
li lime li
l lim lim l
li lime li
lim lim
lime
And the same pattern is followed for other inputs:
a
a
Be
Be
B B
Be
/\
/\
/ /
/\
cat
cat
ca ca
c cat c
ca ca
cat
|||
|||
|| ||
| ||| |
|| ||
|||
.__.
.__.
.__ .__
._ .__. ._
. .__ .__ .
._ .__. ._
.__ .__
.__.
$tring
$tring
$trin $trin
$tri $tring $tri
$tr $trin $trin $tr
$t $tri $tring $tri $t
$ $tr $trin $trin $tr $
$t $tri $tring $tri $t
$tr $trin $trin $tr
$tri $tring $tri
$trin $trin
$tring
Lines in the output may have trailing spaces and there may be one optional trailing newline.
The shortest code in bytes wins.