22
\$\begingroup\$

Your task is to print this exact text:

            z
            yz
           xyz
           wxyz
          vwxyz
          uvwxyz
         tuvwxyz
         stuvwxyz
        rstuvwxyz
        qrstuvwxyz
       pqrstuvwxyz
       opqrstuvwxyz
      nopqrstuvwxyz
      mnopqrstuvwxyz
     lmnopqrstuvwxyz
     klmnopqrstuvwxyz
    jklmnopqrstuvwxyz
    ijklmnopqrstuvwxyz
   hijklmnopqrstuvwxyz
   ghijklmnopqrstuvwxyz
  fghijklmnopqrstuvwxyz
  efghijklmnopqrstuvwxyz
 defghijklmnopqrstuvwxyz
 cdefghijklmnopqrstuvwxyz
bcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz

Case does not matter.

Remember, this is , so the code with the smallest number of bytes wins.

\$\endgroup\$
  • 2
    \$\begingroup\$ Why the downvotes? \$\endgroup\$ – Oliver Ni Oct 25 '16 at 23:31
  • 19
    \$\begingroup\$ I suspect some people are just tired of all the alphabet-pattern ascii-art KC challenges. \$\endgroup\$ – xnor Oct 26 '16 at 0:21
  • \$\begingroup\$ Can we do it in uppercase? \$\endgroup\$ – Downgoat Oct 26 '16 at 3:43
  • 7
    \$\begingroup\$ Seriously though, another alphabet challenge? \$\endgroup\$ – Erik the Outgolfer Oct 26 '16 at 12:57
  • 2
    \$\begingroup\$ I enjoy these alphabet challenges. This one could easily re-branded as a Christmas tree. \$\endgroup\$ – Pete Arden Nov 18 '16 at 21:49

48 Answers 48

6
\$\begingroup\$

Cheddar, 50 45 42 37 bytes

25|>0=>i->print" "*(i/2|0)+(65+i)@"90

Straightforward, but utilizes cheddar's consise ranging syntax (both numerical and alphabetical)

Try it online!

Explanation

25 |> 0 =>    // Map range [0, 26) (i.e. [25, 0] reversed) over....
   i -> 
     print    // Prints in it's own line...
     " " * (i/2 |0) +     // Number of spaces is floor(n/2).
                          // `|0` for flooring is hack from JS
     (65 + i) @" 90       // Char code range is this

65 is char code for A and 90 for A

\$\endgroup\$
  • 1
    \$\begingroup\$ Z is 90, not A. \$\endgroup\$ – Mego Oct 26 '16 at 4:37
5
\$\begingroup\$

05AB1E, 15 13 bytes

A.svy12N;ï-ú,

Try it online! (slightly different from above as ú isn't on TIO yet)

Explanation

  1. Push alphabet
  2. Compute the suffixes of the alphabet
  3. Prepend 12-index/2 spaces
  4. Print
\$\endgroup\$
4
\$\begingroup\$

Python 2, 70 bytes

Ported from Emigna's answer, -2 bytes for replacing -i-1 with ~i

for i in range(26):print' '*(12-i/2)+"abcdefghijklmnopqrstuvwxyz"[~i:]
\$\endgroup\$
  • \$\begingroup\$ I'm fairly sure using map can yield a shorter alphabet, except maybe lowercase having higher values \$\endgroup\$ – Destructible Lemon Oct 26 '16 at 3:25
  • \$\begingroup\$ Actually I'm not sure anymore. I think it wouldn't work for this anyway :( soz \$\endgroup\$ – Destructible Lemon Oct 26 '16 at 3:34
4
\$\begingroup\$

R, 67 66 59 bytes

EDIT: Saved a couple of bytes thanks to @rturnbull

for(i in 25:0)cat(rep(" ",i/2),letters[i:25+1],"\n",sep="")

Exploiting the fact that any number passed to the rep function is automatically rounded down to the closest integer (e.g. rep("*",1.99) => "*") which means that the actual sequence passed is floor(13-1:26/2):

12 12 11 11 10 10  9  9  8  8  7  7  6  6  5  5  4  4  3  3  2  2  1  1  0  0
\$\endgroup\$
  • 1
    \$\begingroup\$ This comes out shorter than my matrix attempt. Replace 14...-1 with 13? \$\endgroup\$ – JDL Oct 26 '16 at 10:23
  • \$\begingroup\$ @JDL Ah yes of course. A remnant of attempting another approach \$\endgroup\$ – Billywob Oct 26 '16 at 11:00
  • 2
    \$\begingroup\$ If you loop through 25:0 instead of 1:26, you can change 13-i/2 to i/2, and simplify (27-i):26 to i:25+1, saving 6 bytes. \$\endgroup\$ – rturnbull Oct 26 '16 at 14:54
3
\$\begingroup\$

Pyth, 15 bytes

j_m+*/d2\ >GdUG

A program that prints the result to STDOUT.

Try it online

How it works

j_m+*/d2\ >GdUG  Program
             UG  Yield [1, 2, 3, 4, ..., 26]
  m              Map over the range with variable d:
          >Gd      Yield alphabet with first d-1 letters discarded
   +               Prepend
     /d2             d//2
    *   \            spaces
 _               Reverse
j                Join on newlines
                 Implicitly print
\$\endgroup\$
  • \$\begingroup\$ Try ; instead of \ \$\endgroup\$ – isaacg Oct 26 '16 at 5:17
3
\$\begingroup\$

Python 2, 52 bytes

n=26;s=''
while n:n-=1;s=chr(97+n)+s;print n/2*' '+s

Accumulates the string s to print and updates the number of leading spaces n/2. A while loop terminating at 0 is a rare numerical loop than beats an exec loop (53 bytes):

n=26;s=''
exec"n-=1;s=chr(97+n)+s;print n/2*' '+s;"*n

Also a 53-byte alternative:

s=''
exec"s=chr(122-len(s))+s;print s.center(26);"*26
\$\endgroup\$
3
\$\begingroup\$

JavaScript (ES6), 85 75 69 68 bytes

for(s=a='',x=36;--x>9;)s+=` `.repeat(x/2-5)+(a=x.toString(36)+a)+`
`

-1 byte thanks to @l4m2.

\$\endgroup\$
  • 2
    \$\begingroup\$ Isn't this a snippet rather than a function or program? \$\endgroup\$ – Neil Oct 27 '16 at 12:35
  • 1
    \$\begingroup\$ for(s=a='',x=36;--x>9;)s+=` `.repeat(x/2-5)+(a=x.toString(36)+a)+'#' 1B shorter \$\endgroup\$ – l4m2 Jan 5 '18 at 11:38
  • \$\begingroup\$ @l4m2 Brilliant! \$\endgroup\$ – darrylyeo Jan 7 '18 at 3:15
  • 1
    \$\begingroup\$ Nice idea using base 36! +1 \$\endgroup\$ – Titus Apr 29 '18 at 15:38
2
\$\begingroup\$

Brain-Flak, 244 bytes

((((((()()()()())){}{}){}){}()){})((((()()()){}){}()){}){(({}[()]<>)<({}<(<>({})<>)>){({}[()]<(({})[()])>)}({}({})<>[({})]<>(((()()()){}){}){}())((<>)<>{<({}[()])><>([{}]())<>}<>[{}]<>{}){({}[()]<((((()()()()){}){}){})>)}((()()()()()){})><>)}<>

Try it online!


This should be readable enough as is. If you need it, I have a full explanation:

push 122 (z): ((((((()()()()())){}{}){}){}()){})
push 26:      ((((()()()){}){}()){})
loop 26 times (i = 25..0): {
 (
  i--, push to b stack:({}[()]<>)
  <
   put 122 from a stack under i: ({}<(<>({})<>)>)
   i times push letter-1: {({}[()]<(({})[()])>)}
   replace top 0 with 26-i: ({}({})<>[({})]<>(((()()()){}){}){}())
   devide by two: ((<>)<>{<({}[()])><>([{}]())<>}<>[{}]<>{})
   add spaces: {({}[()]<((((()()()()){}){}){})>)}
   push 10 (\n): ((()()()()()){})
  >
  flip stack back: <>
 push i--: ) 
}
flip to results stack: <>
\$\endgroup\$
  • 4
    \$\begingroup\$ This should be readable enough as is. You are talking about Brain-Flak, right? \$\endgroup\$ – Erik the Outgolfer Oct 26 '16 at 17:13
2
\$\begingroup\$

Jelly, 15 13 bytes

-2 bytes thanks to @miles (formed a niladic chain I suspected existed but did not form)

ØaJ’H⁶ẋżṫJ$ṚY

TryItOnline!

How?

ØaJ’H⁶ẋżṫJ$ṚY - Main link
Øa            - alphabet yield -> ['a', 'b', 'c', ..., 'y', 'z']
  J           -    range(length)      -> [1, 2, 3, ..., 25, 26]
   ’          -    decrement          -> [0, 1, 2, ..., 24, 25]
    H         -    halve              -> [0,.5  1, ..., 12, 12.5]
     ⁶        -    literal [' ']
      ẋ       -    repeat list        -> [[], [], [' '], ..., 12x' ', 12x' ']
          $   - last two links as a monad
         J    -     range(length)     -> [1, 2, 3, ..., 25, 26]
        ṫ     -     tail (vectorises) -> [['a'-'z'], ['b'-'z'], ..., ['y','z'], ['z']]
       ż      - zip
              -> [[[],['a'-'z']], [[],['b'-'z']], ..., [12x' ',['y','z']], [12x' ',['z]]]
           Ṛ  - reverse whole array
            Y - join with line feeds (implicit print)
\$\endgroup\$
  • \$\begingroup\$ I found a way to form a niladic chain starting with the alphabet ØaJ’H⁶ẋżṫJ$ṚY that saves 2 bytes \$\endgroup\$ – miles Oct 26 '16 at 1:54
  • \$\begingroup\$ Do you think the explanation is correct? \$\endgroup\$ – Jonathan Allan Oct 26 '16 at 17:08
  • 1
    \$\begingroup\$ Yeah just think of it as a monadic chain with a single argument being the alphabet \$\endgroup\$ – miles Oct 26 '16 at 17:41
2
\$\begingroup\$

C, 72 68 bytes

m(i){for(char*k=&k[i=26];i;printf("%*c%s\n",--i/2+1,0,k))*--k=64+i;}
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 5 bytes

A.s.c

Try it online!

A.s.c
A     Push 'abcdefghijklmnopqrstuvwxyz'
 .s   Push suffixes starting from the shortest one
   .c Centralize focused on the left
\$\endgroup\$
1
\$\begingroup\$

Turtlèd, 70 68 bytes

note the trailing space

#abcdefghijklmnopqrstuvwxyz#' -{ -{ +.r_}' l[ l-]d,(*@!' r)(!@*)_}' 

Try it online!

How it works:

#abcdefghijklmnopqrstuvwxyz#              Set string var to this value
                            ' -           write space on first grid cell, string pointer-=1
                               {                                    } While cell is space
                                 -                 decrement string pointer
                                  {     }    While cell is space
                                    +.       increment string pointer, write pointed char
                                      r      move right
                                       _     write non-space if pointed char is last char

                                         '[space]   write space on cell
                                           l        move left
                                            [ l-]   move left, pointer-- until cell's space
                                                 d, move down, write character var \
                                                                           (initially *)

                                                   (*     ) if cell is *
                                                     @!     set char var=!
                                                       ' r  write space over *, move right

                                                           (!    ) if cell is !
                                                             @*    set char var=*
                                                               '[space] write space over !

                                                                 _ (explanation below)
                                               write (*|!) if pointed char is last char

                                                                   '[space]    Write space

Human-readable explanation(?):

It uses the string var to contain the alphabet. Each iteration, it reduces the index by one, until it wraps around, and halts, after getting to the last line. For the alternating indents, it uses the char var. Each iteration it checks the char var and flips it. if it was * it shifts right, so the first character aligns, otherwise not, so the last character aligns.

\$\endgroup\$
1
\$\begingroup\$

Perl, 44 bytes

This is a port of @xnor's answer.

$n=26;say$"x($n/2),$@=chr(97+$n).$@while$n--

Needs -E (or -M5.010) to run :

perl -E '$n=26;say$"x($n/2),$@=chr(97+$n).$@while$n--';
\$\endgroup\$
1
\$\begingroup\$

PHP, 71 Bytes

for(;++$i<27;)echo str_pad(substr(join(range(a,z)),-$i),26," ",2)."\n";
\$\endgroup\$
  • 1
    \$\begingroup\$ (26-$i)/213-$i/2 \$\endgroup\$ – manatwork Oct 26 '16 at 7:01
  • \$\begingroup\$ Will it throw an error if you removed the last colon? Also, would be nice if you provided a link to an online website with example, ex. sandbox.onlinephpfunctions.com \$\endgroup\$ – RedClover Jan 5 '18 at 13:37
1
\$\begingroup\$

Java 7 ,128 127 bytes

Saved 1 byte.Thanks to kevin.

String c(int n,String s,char v,String d){String c="";for(int j=0;j++<(n-1)/2;c+=" ");return n>0?c(--n,s=v+s,--v,d+c+s+"\n"):d;}

ungolfed

  class A {

public static void main(String[] args) {
System.out.print(c(26, "", (char)122, ""));
}
static String c(int n, String s, char v, String d){

    String c = "";

    for (int j = 0; j++ < (n - 1)/2; c += " ");

    return n > 0 ? c(--n, s = v + s, --v, d + c + s + "\n" ) : d;
}
}

Without an passing 122 in a function

132 bytes

String c(String s,int n,String d){String c="";int v=96,j=0;for(;j++<(n-1)/2;c+=" ");return n>0?c(s=(char)(v+n--)+s,n,d+c+s+"\n"):d;}

ungolfed

  class A{

public static void main(String[] args) {
System.out.print(c("",26,""));

}
static String c(String s, int n, String d) {
    String c = "";
    int v = 96,j=0;
    for (; j++ < (n - 1)/2; c += " ");
    return n > 0 ? c(s = ( char) (v + n--) + s, n, (d + c + s + "\n")) : d;
     }
  }
\$\endgroup\$
  • 1
    \$\begingroup\$ You can remove the = at d+=c+s+"\n". Also, you might want to format your ungolfed code a bit with indentations. I noticed that with some of your other answers as well. :) \$\endgroup\$ – Kevin Cruijssen Oct 26 '16 at 6:56
  • 1
    \$\begingroup\$ oops! i did this mistake again,Shame to me. ......ok @KevinCruijssen i am on it. \$\endgroup\$ – Numberknot Oct 26 '16 at 7:20
  • \$\begingroup\$ Can't you replace the s=v+s in the recursion with s+=v? \$\endgroup\$ – Roman Gräf Oct 26 '16 at 13:40
  • \$\begingroup\$ No..because the letters pattern are in backward. \$\endgroup\$ – Numberknot Oct 26 '16 at 13:45
1
\$\begingroup\$

Ruby, 64 bytes

(0..26).each{|x|puts' '*(12-x/2)+('a'..'z').to_a[~x..-1].join()}
\$\endgroup\$
  • \$\begingroup\$ A few comments: You don't need to put the brackets after join Calling each instead of map is unnecessary, since we don't care about what we're returning You can call last on a range \$\endgroup\$ – Lee W Oct 27 '16 at 19:05
  • \$\begingroup\$ Instead of (0..26).map, try 27.times; instead of ('a'..'z').to_a, [*?a..?z]; and instead of .join, *"". \$\endgroup\$ – Jordan Nov 18 '17 at 4:17
1
\$\begingroup\$

Japt, 16 bytes

;C¬£SpY/2 +CsYÃw ·

Try it online!

Explanation:

;C¬£SpY/2 +CsYÃw ·
;C                  // Alphabet shortcut
  ¬                 // Split into an array of chars
   £          Ã     // Map each item X and index Y by:
    SpY/2           //  " " repeated floor(Y/2) times
          +CsY      //  + alphabet.slice(Y)
               w    // Reverse the array of lines
                 ·  // Join with newlines
\$\endgroup\$
1
\$\begingroup\$

REXX, 52 bytes

do i=1 to 26
  say centre(right(xrange(a,z),i),26)
  end

Output:

            Z             
            YZ            
           XYZ            
           WXYZ           
          VWXYZ           
          UVWXYZ          
         TUVWXYZ          
         STUVWXYZ         
        RSTUVWXYZ         
        QRSTUVWXYZ        
       PQRSTUVWXYZ        
       OPQRSTUVWXYZ       
      NOPQRSTUVWXYZ       
      MNOPQRSTUVWXYZ      
     LMNOPQRSTUVWXYZ      
     KLMNOPQRSTUVWXYZ     
    JKLMNOPQRSTUVWXYZ     
    IJKLMNOPQRSTUVWXYZ    
   HIJKLMNOPQRSTUVWXYZ    
   GHIJKLMNOPQRSTUVWXYZ   
  FGHIJKLMNOPQRSTUVWXYZ   
  EFGHIJKLMNOPQRSTUVWXYZ  
 DEFGHIJKLMNOPQRSTUVWXYZ  
 CDEFGHIJKLMNOPQRSTUVWXYZ 
BCDEFGHIJKLMNOPQRSTUVWXYZ 
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\$\endgroup\$
1
\$\begingroup\$

Vim, 25 Keystrokes

:h<_␍jjYZZPqqPxYPr Yq12@q

Where ␍ is the Enter key, also sometimes notated as <cr>.

Explanation

:h<_␍jjYZZ                 " get a-z
          P                " initialize by pasting
           qq              " start record macro @q
             Px            " paste and remove the 1st char
               YPr␣        " yank and paste and replace 1st char with space
                   Y       " yank the whole line again
                    q      " end recording
                     12@q  " call macro 12 @q times

I am new to ViM though -- I started in November. Wondering if there is a way to merge the initializing P with the one in the macro.

What is the "correct" way to test a golfed ViM sequence? I tested with \vi -u /dev/null. However in a VM even :h<_␍ doesn't work. Also not very sure why my ViM will move to the first non space character haha.

P.S. Before I moved to use OS X, I golfed in Hexagony with great tools... Now on OS X I don't do wine and thus not running the great tools for explanations and debugging. So started my journey with ViM!

\$\endgroup\$
1
\$\begingroup\$

C# (.NET Core), 112 bytes

()=>string.Join("\n",new int[26].Select((_,i)=>"".PadLeft(12-i/2)+"abcdefghijklmnopqrstuvwxyz".Substring(25-i)))

Try it online!

()=>string.Join("\n", // OP doesnt want to output a sequence of string...
    new int[26].Select((_,i)=> // yield range from 0 to 25
        "".PadLeft(12-i/2)+ // add spaces to center
            "abcdefghijklmnopqrstuvwxyz".Substring(25-i)))  // remove letters
\$\endgroup\$
1
\$\begingroup\$

Tcl, 92 bytes

set a {}
time {set a [format %c [expr 123-[incr i]]]$a;puts [format %[expr 13+$i/2]s $a]} 26

Try it online!

tcl, 94

set a {}
set i 123
time {set a [format %c [incr i -1]]$a;puts [format %[expr 74-$i/2]s $a]} 26

demo

In the middle of the process, I accidentaly got the italic version of the hat:

tcl, 94

set a {}
set i 123
time {set a [format %c [incr i -1]]$a;puts [format %[expr $i/2-24]s $a]} 26

demo


tcl, 101

set a {}
set i 123
while \$i>97 {set a [format %c [incr i -1]]$a;puts [format %[expr ($i-48)/2]s $a]}

demo

In the middle of the process, I accidentaly got the italic version of the hat:

tcl, 99

set a {}
set i 123
while \$i>97 {set a [format %c [incr i -1]]$a;puts [format %[expr $i/2-24]s $a]}

demo

\$\endgroup\$
  • \$\begingroup\$ 92? \$\endgroup\$ – ASCII-only Apr 26 '18 at 6:23
  • \$\begingroup\$ @ASCII-only thanks! \$\endgroup\$ – sergiol Apr 27 '18 at 11:39
1
\$\begingroup\$

Common Lisp, SBCL, 83 82 bytes

(dotimes(i 27)(format t"~26:@<~a~>
"(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(- 26 i))))

Explanation

(dotimes(i 27) ; loop from i=0 to i=26
(format t"~26:@<~a~>
"(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(- 26 i))))
;print out part of alphabet starting from character number 26-i (counting from zero)
;using justification (~26:@<~a~>) to center with weight 26 characters

-1 using sugestion by ASCII-only to use <enter> instead of ~%

\$\endgroup\$
  • 1
    \$\begingroup\$ 82 \$\endgroup\$ – ASCII-only Apr 26 '18 at 7:19
1
\$\begingroup\$

T-SQL, 107 bytes

DECLARE @t VARCHAR(99)=SPACE(13),@ INT=27a:SET @t=STUFF(@t,@/2,@%2,CHAR(@+95))PRINT @t
SET @-=1IF @>1GOTO a

Modifies the string for each line by cramming in the correct letter at the correct position using the SQL fuction STUFF(). Formatted:

DECLARE @t VARCHAR(99)=SPACE(13), @ INT=27
a:
    SET @t=STUFF(@t,@/2,@%2,CHAR(@+95))
    PRINT @t
    SET @-=1
IF @>1 GOTO a

@/2 uses integer division (no remainder) to determine the position to insert the letter. @%2 is the MODULO function, and flips between 0 (insert the letter) and 1 (overwrite a space).

If you prefer capitial letters, use CHAR(@+63) instead (doesn't change our byte count).

\$\endgroup\$
1
\$\begingroup\$

Perl 5, 40 38 bytes

-2 bytes thanks to @Dom Hastings

say$"x(13+--$x/2),@a[$x..-1]for@a=a..z

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Came up with a slightly different variation for -2: Try it online! \$\endgroup\$ – Dom Hastings Apr 27 '18 at 19:56
1
\$\begingroup\$

Stax, 7 bytes

ô2òΘé8└

Run and debug it

\$\endgroup\$
0
\$\begingroup\$

Haskell (Lambdabot), 73 bytes

unlines[([1..div(26-length x)2]>>" ")++x|x<-reverse.init$tails['a'..'z']]

same length:

do x<-reverse.init$tails['a'..'z'];([1..div(26-length x)2]>>" ")++x++"\n"

I use init.tails or tail.inits with a possible reverse in front in pretty much every challenge; I wish they would add it to Prelude already.

\$\endgroup\$
0
\$\begingroup\$

Python 2, 66 64 bytes

i=91;exec'i-=1;print`map(chr,range(i,91))`[2::5].center(26);'*26
\$\endgroup\$
0
\$\begingroup\$

Groovy, 53 bytes

('z'..'a').each{println((it..'z').join().center(26))}

Output:

            z             
            yz            
           xyz            
           wxyz           
          vwxyz           
          uvwxyz          
         tuvwxyz          
         stuvwxyz         
        rstuvwxyz         
        qrstuvwxyz        
       pqrstuvwxyz        
       opqrstuvwxyz       
      nopqrstuvwxyz       
      mnopqrstuvwxyz      
     lmnopqrstuvwxyz      
     klmnopqrstuvwxyz     
    jklmnopqrstuvwxyz     
    ijklmnopqrstuvwxyz    
   hijklmnopqrstuvwxyz    
   ghijklmnopqrstuvwxyz   
  fghijklmnopqrstuvwxyz   
  efghijklmnopqrstuvwxyz  
 defghijklmnopqrstuvwxyz  
 cdefghijklmnopqrstuvwxyz 
bcdefghijklmnopqrstuvwxyz 
abcdefghijklmnopqrstuvwxyz
\$\endgroup\$
0
\$\begingroup\$

QBIC, 57 bytes

[25,0,-1|Y=Z[1,a/2|Y=Y+@ |]X=Z[a,25|X=X+$CHR$(65+|c)]?Y+X

This one works surprisingly well with QBIC' FOR loops. Explanation (of previous version - same principle applies):

[26,1,-1|          Loops from 26 to 1, decrementing 'a'
                   'a' is used to determine the number of spaces per line and the last letter we want to print
Y=Z                Z is always an empty string in this program, 
                   Y will hold the spaces we need to center this line
[1,a/2|Y=Y+@ |]    Add a space to Y equal to half the value of 'a', giving us a center alignment
X=Z                X holds the characters we need on this line, reset it
[a,26|             FOR c = a to 26 --> loop over the last part of the alphabet
X=X+$CHR$(64+|c)]  Convert c+64 to ASCII and append
?Y+X               Print the spaces and the letters

<outer FOR loop is closed by QBIC>

Output:

            Z
            YZ
           XYZ
           WXYZ
          VWXYZ
          UVWXYZ
         TUVWXYZ
         STUVWXYZ
        RSTUVWXYZ
        QRSTUVWXYZ
       PQRSTUVWXYZ
       OPQRSTUVWXYZ
      NOPQRSTUVWXYZ
      MNOPQRSTUVWXYZ
     LMNOPQRSTUVWXYZ
     KLMNOPQRSTUVWXYZ
    JKLMNOPQRSTUVWXYZ
    IJKLMNOPQRSTUVWXYZ
   HIJKLMNOPQRSTUVWXYZ
   GHIJKLMNOPQRSTUVWXYZ
  FGHIJKLMNOPQRSTUVWXYZ
  EFGHIJKLMNOPQRSTUVWXYZ
 DEFGHIJKLMNOPQRSTUVWXYZ
 CDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\$\endgroup\$
  • \$\begingroup\$ Doesn't match the OP. \$\endgroup\$ – Magic Octopus Urn Oct 26 '16 at 17:43
  • \$\begingroup\$ @carusocomputing it does now. \$\endgroup\$ – steenbergh Oct 26 '16 at 21:50
0
\$\begingroup\$

Racket 137 bytes

(for((n(range 122 96 -1)))(for((i(floor(/(- n 97)2))))(display #\space))
(for((i(range n 123)))(display(integer->char i)))(displayln ""))

Ungolfed:

(define (f)
  (for ((n (range 122 96 -1)))
       (for ((i (floor(/(- n 97)2))))
         (display #\space))
       (for ((i (range n 123)))
         (display (integer->char i)))
    (displayln "")))

Testing:

(f)

Output:

            z
            yz
           xyz
           wxyz
          vwxyz
          uvwxyz
         tuvwxyz
         stuvwxyz
        rstuvwxyz
        qrstuvwxyz
       pqrstuvwxyz
       opqrstuvwxyz
      nopqrstuvwxyz
      mnopqrstuvwxyz
     lmnopqrstuvwxyz
     klmnopqrstuvwxyz
    jklmnopqrstuvwxyz
    ijklmnopqrstuvwxyz
   hijklmnopqrstuvwxyz
   ghijklmnopqrstuvwxyz
  fghijklmnopqrstuvwxyz
  efghijklmnopqrstuvwxyz
 defghijklmnopqrstuvwxyz
 cdefghijklmnopqrstuvwxyz
bcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.