55
8
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 justABCwithout 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\nor 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!
 
Are leading newlines allowed? – Erik the Outgolfer – 2017-09-02T13:46:11.430
@EriktheOutgolfer Sure, as long as it doesn't mess up grid structure. – shooqie – 2017-09-02T13:49:57.173
Would it be okay if a non-fatal error stops the program? – Zacharý – 2017-09-02T21:07:20.710
@Zacharý Although I can see how that could save some bytes, I think it's ugly and produces undesired, superfluous output. So no. EDIT: Unless you can make your program non-fatally exit through an exit code or something that wouldn't print exception stack trace or something similar to stderr. – shooqie – 2017-09-02T21:09:41.317
Okay, my answer doesn't error. – Zacharý – 2017-09-02T21:16:26.060
list of strings is not a proper output formatDo you mean the list containing each line, or any type of list of strings? This meta consensus states that a list of characters (i.e. each element is a single character) is a valid string, mainly because some languages lack such distinction. – JungHwan Min – 2017-09-03T00:47:34.270@JungHwanMin Yeah, I realize that.By "list of lines" i mean specifically output like
["AB(...)", "(...)XYZ", "(...)"]– shooqie – 2017-09-03T15:04:45.2737Suggested test case:
BALLOON(two adjacent characters that are the same). – Kevin Cruijssen – 2017-09-04T12:37:08.067Go the answer in PHP https://gist.github.com/elminson/37d3caa43033f901dd100386f7ae7bde
– Elminson De Oleo Baez – 2019-12-24T05:38:08.920