#Japt -R
, 24 23 1717 15 bytes
Outputs an array, includes a leading newline and a leading & trailing space on each line.
IòUc @SiXd)pY)iYçÏçSiXd¹iYç
Test itTest it
- 1 byte saved with help from Oliver and a further 6 thanks to him pointing out a better way to generate the initial array.
We can get rid of the leading newline and spaces at the cost of 2 bytes:
IòUc)Å£SiXd)pYÄ)iYç
Test it
##Explanation
Implicit input of uppercase character string U
.
IòUc
Generate an array of integers (ò
) from 64 (I
) to U
's character code, inclusive.
@
Pass each through a function where X
is the current integer and Y
is the current index.
SiXd)
Prepend (i
) a space (S
) with the character at codepoint X
.
pY
Repeat that Y
times.
iYç
To that prepend a space character repeated Y
times.
Implicit output of resulting array.