Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation.
For example, if the input grid of text is
abcd
1234
WXYZ
then you'd line up the diagonals W
, 1X
, a2Y
, b3z
, c4
, and d
in columns giving this output:
ab
123c
WXYZ4d
Note that the lowest-rightmost characters of all diagonals, WXYZ4d
, are at the same level.
Details
The input grid of text will be at minimum 1×1 in size and all lines will be the same length.
You may take the input grid as a multiline string or as a list of single line strings.
The input grid will only contains printable ASCII characters (includes space).
The output may optionally have one trailing newline but there should be no other empty lines.
The lines of the output may optionally have trailing spaces but should not have unnecessary leading spaces.
Other Examples
Empty lines separate examples. Each input is directly followed by its output.
123
456
789
1
452
78963
123.?!
456??!
789!!!
123.
456???
789!!!!!
**@
@
**
@ @
/\/\
\/ /
/ /\
\/\/
/
\/\
/ / /
\/\/\/\
12
34
56
78
90
7531
908642
Code
Code
G
O
L
F
FLOG
~
~
Scoring
The shortest code in bytes wins.