Inspired by a meme I saw earlier today.
Challenge description
Consider an infinite alphabet grid:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
...
Take a word (CODEGOLF
in this example) and make it a subsequence of the grid, replacing unused letters by a space and removing letters at the end of the infinite grid altogether:
C O
DE G O
L
F
Examples
STACKEXCHANGE
ST
A C K
E X
C H
A N
G
E
ZYXWVUTSRQPONMLKJIHGFEDCBA
Z
Y
X
W
V
U
T
S
R
Q
P
O
N
M
L
K
J
I
H
G
F
E
D
C
B
A
F
F
ANTIDISESTABLISHMENTARIANISM
A N T
I
D I S
E ST
AB L
I S
H M
E N T
A R
I
A N
I S
M
Notes
- Trailing whitespaces are allowed.
- You don't need to pad
the lastany line with spaces. For example, if the input isABC
, you may output justABC
without 23 trailing spaces. - You may assume input will match
[A-Z]+
regex. - Alternatively, you may use lower-case alphabet, in which case output will match
[a-z]+
. - You must use a newline (
\n
,\r\n
or equivalent) to separate lines, that is a list of strings is not a proper output format. - This is a code-golf challenge, so make your code as short as possible!
BALLOON
(two adjacent characters that are the same). \$\endgroup\$