10
This challenge is inspired by a SO question about traversing a matrix by enumerating all its diagonal strips.
Instead of a matrix, consider a block of text:
ABCD
EFGH
IJKL
Traversing this block's SW-NE diagonals from left to right, starting from the top left corner and ending in the bottom right, results in the following output:
A
EB
IFC
JGD
KH
L
Challenge
Write a program or a function that execute the reverse of the process described above. That is, given a set SW-NE diagonal strips, output the block of text that produced it.
Input and Output
Both input and output can be represented as strings with newlines, or arrays/lists of strings.
Trailing newlines are optional.
The input will consist of at least one printable character and can be assumed to be correct (there will not be inconsistent row lengths).
The output block will always have a number of columns greater than or equal to the number of rows.
Test Cases
Input:
A
Output:
A
Input:
.
LI
PO.
PV.
CE
G
Output:
.I..
LOVE
PPCG
Input:
M
DA
AIT
LAR
SGI
/OX
/N
/
Output:
MATRIX
DIAGON
ALS///
Will the input strings contain any spaces? – kirbyfan64sos – 2015-09-16T19:40:53.720
Also, is trailing whitespace allowed? – kirbyfan64sos – 2015-09-16T19:46:24.853
@kirbyfan64sos Yes, input may contain spaces. Trailing whitespace is allowed. – Cristian Lupascu – 2015-09-17T06:38:58.053