# Make an alphabet searchlight!

Inspired by a bug in a solution to this challenge, your challenge is to produce this exact text:

                         ZYXWVUTSRQPONMLKJIHGFEDCBA
YXWVUTSRQPONMLKJIHGFEDCBA
XWVUTSRQPONMLKJIHGFEDCBA
WVUTSRQPONMLKJIHGFEDCBA
VUTSRQPONMLKJIHGFEDCBA
UTSRQPONMLKJIHGFEDCBA
TSRQPONMLKJIHGFEDCBA
SRQPONMLKJIHGFEDCBA
RQPONMLKJIHGFEDCBA
QPONMLKJIHGFEDCBA
PONMLKJIHGFEDCBA
ONMLKJIHGFEDCBA
NMLKJIHGFEDCBA
MLKJIHGFEDCBA
LKJIHGFEDCBA
KJIHGFEDCBA
JIHGFEDCBA
IHGFEDCBA
HGFEDCBA
GFEDCBA
FEDCBA
EDCBA
DCBA
CBA
BA
A

• The first line will have 25 spaces, then the alphabet backwards starting from the 26th letter (ZYXWVUTSRQPONMLKJIHGFEDCBA), then a newline.
• The second line will have 24 spaces, then the alphabet backwards starting from the 25th letter (YXWVUTSRQPONMLKJIHGFEDCBA), then a newline.
• ...
• The last (26th) line will have no spaces, then the alphabet backwards starting from the 1st letter (A), then a newline.

• Your program may use any allowed output methods.
• One trailing newline and/or one leading newline is allowed.
• There must be one newline between lines containing the letters, no more.
• The letters must be all uppercase.

As with , the shortest submission wins. Good luck!

var QUESTION_ID=141725,OVERRIDE_USER=61563;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

• To me it looks like the light cast by the bat-signal – scottinet Sep 5 '17 at 19:47
• – Mr. Xcoder Sep 5 '17 at 20:26
• Can each line have an extra space in front of it? – HyperNeutrino Sep 5 '17 at 20:35
• Could each line have trailing spaces after the last letter? – miles Sep 5 '17 at 20:49
• @miles yes, that's fine. – MD XF Sep 5 '17 at 21:34

# 05AB1E, 7 bytes

### Code:

₂žp.s1Λ


Uses the 05AB1E encoding. Try it online!

### Explanation

 žp.s      # Get the suffixes of ZYX...CBA
Λ    # Using the canvas mode, print the
₂          # first 26 elements of the array
1     # into the upper-right direction

• @MDXF IMO, that's a really dumb rule – DJMcMayhem Sep 5 '17 at 20:20
• Hmm... I guess I'll remove the rule, then. status-completed – MD XF Sep 5 '17 at 20:22
• I might propose a PR documenting that feature when I find the time. Seems to be a good way to learn a bit of python from a well-written, easy-to-read code – scottinet Sep 6 '17 at 8:39
• Why does žp exist when Au is golden? BADUM tissss – Magic Octopus Urn Sep 6 '17 at 17:44
• Using 05AB1E, create a file documenting all of it's features, shortes code wins :P – Christian Sep 8 '17 at 8:30

# R, 67 55 bytes

for(i in 26:1)cat(rep(" ",i-1),LETTERS[i:1],"
",sep="")


Try it online!

• R is beating Python on a string challenge? Nice. +1 for LETTERS – CriminallyVulgar Sep 6 '17 at 10:00
• @CriminallyVulgar it's a very weird challenge; Haskell is beating the tie of PHP and R which are both beating Python... at least Perl is ahead of all of them like you might expect. – CR Drost Sep 8 '17 at 20:13
• -2 bytes if you change sep to s. Functions will autocomplete named arguments if there aren't collisions – Punintended Mar 30 '18 at 17:12
• @Punintended that won't work because of the ... argument; arguments that come before ... (typically) get partial matched, and those after don't. I believe there are a few exceptions but cat isn't one of them – Giuseppe Mar 30 '18 at 17:30
• @Giuseppe I don't see a ... – MilkyWay90 Jun 13 '19 at 21:09

# Python 2, 57 bytes

i=26
while i:i-=1;print' '*i+bytearray(range(65+i,64,-1))


Try it online!

# V, 13, 11 bytes

¬ZAòY>HGpxl


Try it online!

Hexdump:

00000000: ac5a 41f2 593e 4847 7078 6c              .ZA.Y>HGpxl


Written from my phone :P.

¬ZA         " Insert the alphabet backwards
ò        " Recursively:
Y       "   Yank this current line
>H     "   Add one space to every line
G    "   Move to the last line in the buffer
p   "   Paste the line we yanked
x  "   Delete one character
l "   Move one character to the right, which will throw an error on
"   the last time through, breaking the loop

• I do these on my phone too, +1 – Stan Strum Sep 5 '17 at 22:45

# PowerShell, 42 bytes

25..0|%{' '*$_+-join[char[]]((65+$_)..65)}


Try it online!

### Explanation:

25..0|%{                                 } # Loop from 25 to 0
(65+$_)..65 # Construct a range of the specific ASCII codes [char[]]( ) # Cast that as a character array -join # that has been joined together into a string ' '*$_+                            # Prepended with the correct amount of spaces


# Bash + GNU sed, 60

printf %s {Z..A}|sed 'h
s/./ /g
G
s/ \n//
:x
p
s/ \S//
tx
d'

• You can save two bytes by changing :x to : and tx to t. – Jordan Oct 30 '17 at 1:02

# ///, 105 97 bytes

/:/\\\\*//#/: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//\\*/\/\/_____#
\/ //_/     //*#


Try it online!

### Explanation

/// only knows one command, /<pattern>/<substitution>/<text> replaces all occurrences of <pattern> in <text> with <substitution>. Additionally \ can be used to escape characters.

Shortened code for simplicity:

/:/\\\\*//#/:E:D:C:B:A//\\*/\/\/__#
\/ //_/  //*#


The first command /:/\\\\*/ replaces : with \\* in the subsequent code. This gives:

/#/\\*E\\*D\\*C\\*B\\*A//\\*/\/\/__#
\/ //_/  //*#


Then /#/\\*E\\*D\\*C\\*B\\*A/ replaces # with \*E\*D\*C\*B\*A:

/\\*/\/\/__\*E\*D\*C\*B\*A
\/ //_/  //*\*E\*D\*C\*B\*A


Then /\\*/\/\/__\*E\*D\*C\*B\*A<newline>\/ / replaces \* with //__*E*D*C*B*A<newline>/:

/_/  //*//__*E*D*C*B*A
/ E//__*E*D*C*B*A
/ D//__*E*D*C*B*A
/ C//__*E*D*C*B*A
/ B//__*E*D*C*B*A
/ A


Notice: I had to use \* for replacement. Since * is also part of the substitution, it would generate an infinite loop if I only replace *.

Then command /_/ / replaces _ with spaces, and /*// deletes all *:

EDCBA
/ E//    EDCBA
/ D//    EDCBA
/ C//    EDCBA
/ B//    EDCBA
/ A


The next command /#// replaces # by nothing. Since there is no # in the code, it does nothing. This is just here to remove the two leadings // from the beginning of the code. This leaves

EDCBA
/ E//    EDCBA
/ D//    EDCBA
/ C//    EDCBA
/ B//    EDCBA
/


Then the command / E// removes <space>E, so this will leave the code

    EDCBA
DCBA
/ D//   DCBA
/ C//   DCBA
/ B//   DCBA
/


Similar / D// removes <space>D:

    EDCBA
DCBA
CBA
/ C//  CBA
/ B//  CBA
/


/ C//:

    EDCBA
DCBA
CBA
BA
/ B// BA
/


/ B//:

    EDCBA
DCBA
CBA
BA
A
/


And the last command is incomplete, so it does nothing:

    EDCBA
DCBA
CBA
BA
A

• Same lengths as the C# and brainfuck answers :D – Conor O'Brien Sep 7 '17 at 0:30

f(a:b)=(b>>" ")++a:b++'\n':f b
f x=x
f['Z','Y'..'A']


Try it online!

How it works

f['Z','Y'..'A']        -- call f with the full backwards alphabet

f(a:b)=                -- let a be the first char and b the rest. Return
(b>>" ") ++         -- replace each char in b with a space, followed by
a:b ++              -- the input string, followed by
'\n' :              -- a newline, followed by
f b                 -- a recursive call of f with b
f x=x                  -- stop on an empty input string

• Why doesn't f['Z'..'A'] work? – Conor O'Brien Sep 6 '17 at 10:49
• @ConorO'Brien: [a..b] starts with a and collects all the successors (+1 for integers, next ascii-char for characters, etc.) up to b. If a > b this is an empty list. However, you can specify also the second value (which can be smaller) from which an increment/decrement is calculated. [1,3..8] -> [1,3,5,7], [15,10..0] -> [15,10,5,0], or ['Z','Y'..'A'] which is the backwards uppercase alphabet. – nimi Sep 6 '17 at 16:09
• Ah, I see now. Thanks! – Conor O'Brien Sep 6 '17 at 18:19

# Python 2, 66 64

i=26
while i:i-=1;print' '*i+'ZYXWVUTSRQPONMLKJIHGFEDCBA'[25-i:]


Try it online!

• Welcome to Programming Puzzles & Code Golf - nice first answer! – MD XF Sep 5 '17 at 20:43
• Thanks! Figured I'd give it a try instead of just lurking. – Artemis_134 Sep 5 '17 at 20:45
• You can remove the space between print and ' for 65 bytes. – Mr. Xcoder Sep 5 '17 at 20:48
• I ported your answer into Pyth, take a look: codegolf.stackexchange.com/a/141939/63757 – Stan Strum Sep 7 '17 at 2:40

# JavaScript (ES6), 8377 76 bytes

f=(n=0,p='')=>n<26?f(++n,p+' ')+p+ZYXWVUTSRQPONMLKJIHGFEDCBA
.slice(~n):''

o.innerText = f()
<pre id=o>

• I had wanted to suggest you an improvement, but then I realized that our approaches are very different. Hope you don't mind. – user72349 Sep 5 '17 at 21:16
• @ThePirateBay No problem! – Arnauld Sep 5 '17 at 21:17

# Jelly, 12 bytes

ØAµ⁶ṁḊ;ṚµƤṚY


Try it online!

ØAµ⁶ṁḊ;ṚµƤṚY  Main Link
ØA            "ABC...XYZ"
Ƥ    For each prefix,
⁶          ' '
ṁ         (with automatic repetition) molded to the shape of
Ḋ        All but the first letter of the input (repeat - 1)
;       With the input          appended to it
Ṛ                     reversed
Y  Join on newlines


-3 bytes thanks to miles

• 13 bytes – Leaky Nun Sep 5 '17 at 20:32
• @LeakyNun Oh right cool thanks! – HyperNeutrino Sep 5 '17 at 20:33
• Yay, another use for the prefix quick. 12 bytes since mold will reshape here using the length implicitly. – miles Sep 5 '17 at 20:37
• @LeakyNun Actually, unfortunately that would make it invalid because there cannot be extra spaces (it would take 2 bytes to fix) – HyperNeutrino Sep 5 '17 at 20:37

# brainfuck, 105 bytes

++++++++[>+>+++++++++++>++++>+++<<<<-]>++>++>>++[[->+>+<<]>-[-<<.>>]>[-<<<<.->>>+>]<-[-<+<<+>>>]<<<<.>>>]


Try it online!

Minified and formatted:

++++++++[>+>+++
++++++++>++++>+
++<<<<-]>++>++>
>++[[->+>+<<]>-
[-<<.>>]>[-<<<<
.->>>+>]<-[-<+<
<+>>>]<<<<.>>>]


[
pre-initialize the tape with the values 10 90 32 >26<
C_NEWLINE: 10
V_ALPHA: 90
C_SPACE: 32
V_COUNTER: 26

AS:

10 = 8 *  1 + 2
90 = 8 * 11 + 2
32 = 8 *  4 + 0
26 = 8 *  3 + 2
]

8 ++++++++ [
*  1 >+
* 11 >+++++++++++
*  4 >++++
*  3 >+++
<<<<-]
PLUS 2 >++
PLUS 2 >++
PLUS 0 >
PLUS 2 >++

UNTIL V_COUNTER == 0 [
COPY V_COUNTER to RIGHT and RIGHT_RIGHT
[->+>+<<]
TAPE: 10 V_ALPHA 32 >0< V_COUNTER_R V_COUNTER_RR
V_COUNTER_R SUB 1 TIMES: >-[-
PRINT C_SPACE <<.
>>]
TAPE: 10 V_ALPHA 32 0 >0< V_COUNTER_RR
V_COUNTER_RR TIMES: >[-
PRINT V_ALPHA <<<<.
DECREMENT V_ALPHA -
INCREMENT V_COUNTER_R >>>+
>]
TAPE: 10 V_ALPHA 32 0 V_COUNTER_R(26) >0<
V_COUNTER_R SUB 1 TIMES: <-[-
INCREMENT V_COUNTER <+
INCREMENT V_ALPHA <<+
>>>]
PRINT C_NEWLINE <<<<.
>>>]


# Octave, 534946 45 bytes

1 byte removed thanks to @Sanchises

for k=25:-1:0,disp([blanks(k) 65+k:-1:65])end


Try it online!

• @Sanchises Thanks! – Luis Mendo Sep 7 '17 at 11:21

# Poetic, 601 bytes

one night i camped a bit
throughout all the forest now
the sweet sights
i saw giant things
i saw little small things
here i am
seated around all my trees i saw
i sleep
i sle-e-p
sleep in a cabin
i am sleep-y
i sleep a bit
i awaken in bed
i stand
i walk
i saw a vision of a dragon
i am fooled
i know i am
should i f-ight
i f-light
i did f-light
i did a flight
go away,i do imply
i*m afraid
i run
i leave
i flee
i am timid
i*m just a person,not toughie-tough-guy
no,never
i*m waste
i am stupid
a quitter i was
i am stupid
i*m turning around
i do not appreciate camping
i cry
i am crying
no
no


Poetic is an esolang I created in 2018 for a class project, and it is a brainfuck derivative in which the lengths of words correspond to brainfuck commands (and the +, -, >, and < commands each have 1-digit arguments).

The fact that only word-length dictates the commands means that I technically could have created a program entirely composed of non-words (i.e. the letter X as many times as needed, with spaces in between words), but I wanted to make an interesting free-verse poem out of it while not adding any unnecessary bytes.

If you want to try it online (which is half the point of the class project in the first place), check out my online interpreter!

# 05AB1E, 10 bytes

žpDvÐg<ú,¦


Try it online!

Explanations:

žpDvÐg<ú,¦
žp           Push the uppercased alphabet, reversed
D          Duplicate
v         For each letter (we just want to loop 26 times, so we use the
already pushed alphabet for that purpose)
Ð        Triplicate
g<      Length of the string - 1
ú     Add that number of spaces at the beginning of the string
,    Print with newline
¦   Remove the 1st element of the remaining copy of the string


# Perl 6, 37 bytes

Saved 9 bytes thanks to @Massa.

say " "x$_,chrs$_+65...65 for 25...0


Try it online!

Explanation: 25...0 is a range from 25 to 0 (as expected). We iterate over that range, saying (= printing with newline) that many spaces and the string of characters that have ASCII codes (chrs) from 65 + that number ($_+65...65). • 25...0 is the shorter way :-) – Massa Sep 6 '17 at 14:38 • try say " "x$_,chrs $_+65...65 for 25...0 :-) – Massa Sep 6 '17 at 14:41 • Many thanks! I never knew about that! And the sub form is better too (too bad I made this one from the top of my head). (This is why I like to use Perl 6 for codegolf, I always discover something new.) – Ramillies Sep 6 '17 at 18:28 # Charcoal, 19 11 bytes -8 bytes thanks to ASCII-only. Ｆ²⁶«Ｐ⮌…α⊕ι↗  Try it online! Link is to verbose version. • This maybe? tio.run/##S85ILErOT8z5/… – ASCII-only Sep 5 '17 at 21:10 • Wait noooooo there's leading space – ASCII-only Sep 5 '17 at 21:11 • Son of a... I need to look through every single command and operator Charcoal has. >_> Thanks! – totallyhuman Sep 5 '17 at 21:11 • Fixed tio.run/… – ASCII-only Sep 5 '17 at 21:12 • @ASCII-only CycleChop...but you forgot Increment (or whatever it's called) – Erik the Outgolfer Sep 6 '17 at 9:00 ## Perl 5, 36 bytes 35 bytes code + 1 for -p. $\=$"x$-++.($a=$_.$a).$/.$\for A..Z  Note: TIO doesn't support empty input, so a newline is provided, this results in an extraneous newline, but when running at command-line with empty input, this is not displayed. Try it online! # Ruby, 54 52 bytes 25.downto 0{|n|puts' '*n+[*?A..?Z][0..n].reverse*''}  Try it online! # Cubix, 43 46 bytes $/\;u:\s/':(!$u;:'@^!@Wu;oSU;o+<u(;;oN;(!|  Try it online! Cubified $ / \
; u :
\ s /
'  : ( ! $u ; : ' @ ^ ! @ W u ; o S U ; o + < u ( ; ; o N ; ( ! | . . . . . . . . . . .  Watch it run Have managed to shave a few more of this, but it was a bit more difficult than I thought. There is a substitute character after the first quote to give me 26. • '<sub> push 26 onto the stack as the base number • :(! duplicate base as a counter, decrement, test for truthy • u on true skip the $ command and u-turn to the right
• So;u push 32, output as character, pop 32 and u-turn right onto the decrement
• $ on false jump the next u command • ;:'@^ pop, duplicate the base number, push 64 onto stack and redirect into a torturous route • $\s/:\/u;$ this is the order of the steps on the top face. It boils down to swap the counter with the 64. Ends with a skip over the redirect that put it here. • <+o;U redirect to add, output character, pop, u-turn left • (! decrement, test for truthy. If true starts on a path which hits the u-turn and goes back to the redirect. • |(;No on false, reflect, redundant test, redundant decrement, pop, push 10 and output character • ;;(u!@W pop down to the base number, decrement, u-turn right onto truthy test, halt if false otherwise change lane onto the duplicate at the beginning. Rinse and repeat. # Python, 83 bytes [print(' '*i+''.join([chr(64+i)for i in range(i+1,0,-1)]))for i in range(25,-1,-1)]  My first answer on codegolf :) • A belated welcome to PPCG! nice answer! – Conor O'Brien Sep 8 '17 at 22:36 # sed 4.2.2 + Bash, 50 bytes s/^/printf %25s;printf %s {Z..A}/e : p s/ \S// t d  Try it online! # Bash + sed 4.2.2, 51 bytes printf %s {Z..A}|sed 'h s/./ /g G : s/ [^ ]//p t d'  Building on @DigitalTrauma's answer. Try it online! # Vim, 43 keystrokes :h<_<CR>jjYZZPVgUxjpqqy$-i <Esc>lpl"aDYPD"ap+q25@q


You can see it in action in this GIF made using Lynn's python script

# JavaScript, 75 74 bytes

1 byte saved thanks to Rick Hitchcock

f=(a=65,b='',c)=>a>90?'':f(a+1,b+' ',c=String.fromCharCode(a)+[c])+
+b+c


Try it online!

• Save a byte by initializing b (b=''), then taking b out of the square brackets. – Rick Hitchcock Sep 5 '17 at 22:21
• @RickHitchcock. Thanks. – user72349 Sep 5 '17 at 22:27

# Perl 5, 49 bytes

$_=$"x26 .join'',reverse A..Z,Z;say while s/ \S//


Try it online!

• Looks like you're missing the first A, but seems that can be fixed by changing $"x25 to $"x26! – Dom Hastings Sep 6 '17 at 8:58
• When I added the extra Z, I forgot to account for that. – Xcali Sep 6 '17 at 13:06

# Pyke, 8 bytes

G_.<XFo}h-


Try it here!

           -  o = 0
G_         -    reversed(alphabet)
.<       -   suffixes(^)
XF     -  for i in ^:
o    -      o++
}   -     ^ * 2
h  -    ^ + 1
- for i in reversed(^):
-  print i


I can see the right language doing this in 6 bytes if they had a builtin for prepend n spaces to string as well as what Pyke does

# PHP (6358 55 bytes)

This is possibly my favorite strange corner of PHP, a corner which it inherits from Perl:

for($c=A;$c!=AA;$q="$s$z$q",$s.=" ")$z=$c++.$z;echo$q;  This outputs the trailing newline, as explicitly permitted. This can be run in php -r to save the opening <?php needed to put this in a file. Explanation: when a variable containing the string 'A' is incremented in PHP, it becomes 'B' and then 'C' and so on up until 'Z' becomes 'AA'. There is no digit before 'A' to start with in this madcap algebra, and the decrement operator does not undo it, so we save the incrementally reversed alphabet to $z (which defaults to NULL which when it gets concatenated with a string behaves like the empty string -- the same happens with $s and $q). Whitespace is accumulated in $s and the whole string is accumulated backwards in variable $q which means we have to echo it at the end.

Thanks to Titus for golfing off my curly braces and telling me that I don't need to take a penalty for inline-evaluation flags like -r.

• That´s 57 bytes, if you use a linux linebreak. -r is free. Two bytes shorter: for($c=A;$c!=AA;$q="$s$z\n$q",$s.=" ")$z=$c++.$z;echo$q; – Titus Sep 8 '17 at 18:32 • @Titus thanks, gave you a kudos in the answer. – CR Drost Sep 8 '17 at 20:08 • nm. Just note that -R and -F are not free. See codegolf.meta.stackexchange.com/questions/2424/… – Titus Sep 9 '17 at 9:04 • I believe you can save a byte if you use $c<AA. – Ismael Miguel Sep 20 '17 at 19:25
• @IsmaelMiguel sorry, I was too terse. I was thinking when I wrote that, "maybe there is a way to shuffle things around without gaining bytes so that the A case happens first and then we can detect AA vs. B but I do not think that I am smart enough to see it." I didn't mean to be flippant and I will try to watch out for that in the future. – CR Drost Sep 20 '17 at 19:44

# SOGL V0.12, 10 8 bytes

Z±{Xf}⁰¼


Try it Here!

• Just curious, how long is the compressed version? – caird coinheringaahing Sep 5 '17 at 21:01
• @cairdcoinheringaahing TL;DR way too long. SOGLs compression sucks at (and is specifically made not for) repetitive stuff. It'd be very hard to tell as the compression isn't automated (automation would make it take 701 choose x attempts for any integer x) but a rough attempt was 450 bytes :P – dzaima Sep 5 '17 at 21:12

# Common Lisp, 84 82 bytes

(dotimes(i 26)(format t"~v@{ ~}~a
"(- 25 i)(subseq"ZYXWVUTSRQPONMLKJIHGFEDCBA"i)))


Try it online!

Two bytes less thanks to @Ascii-only!

• 82 – ASCII-only Apr 26 '18 at 5:52

# Python 2, 72 67 bytes

i=26
while-~i:print' '*i+''.join(map(chr,range(65,91)))[i::-1];i-=1


Try it online!

• – Mr. Xcoder Sep 5 '17 at 20:46