You are to print this exact text:



  • You can print all lowercase instead of all uppercase. However, case must be consistent throughout the output.
  • You may print one extra trailing linefeed.


Since this is an alphabet wave that fluctuates to a small extent, your code should also be small in terms of byte-count. In fact, the smallest code in terms of byte-count wins.

  • 39
    \$\begingroup\$ Seriously, another alphabet challenge? \$\endgroup\$ – Nathan Merrill Aug 9 '16 at 23:33
  • 6
    \$\begingroup\$ @NathanMerrill As numerous as they are, I don't think they are worthy of downvotes. (I do not imply you downvoted, I am merely saying.) \$\endgroup\$ – Conor O'Brien Aug 9 '16 at 23:34
  • 14
    \$\begingroup\$ As long as the patterns are sufficiently different, I don't think it matters if we use the alphabet, decimal digits, asterisks and underscore, etc. \$\endgroup\$ – Dennis Aug 9 '16 at 23:35
  • 9
    \$\begingroup\$ @Dennis regardless of the characters used, its these type of "pattern" challenges that are getting overused, IMO. I don't think its offtopic, but I would enjoy some fresh air. \$\endgroup\$ – Nathan Merrill Aug 9 '16 at 23:40
  • 13
    \$\begingroup\$ It's clear there's no more demand for alphabet challenges - only 39 people answered in the first 15 hours... \$\endgroup\$ – trichoplax Aug 10 '16 at 15:23

83 Answers 83


C, 60 bytes

  • 10
    \$\begingroup\$ This is genius. \$\endgroup\$ – Leaky Nun Aug 10 '16 at 6:11
  • \$\begingroup\$ Nice to see C in a code golf challenge. \$\endgroup\$ – Micheal Johnson Aug 11 '16 at 14:03
  • \$\begingroup\$ @MichealJohnson "see C", I C what you did there. ;) And I agree with Leaky Nun. Sometimes I wonder how people come up with some of these ingenious answers. \$\endgroup\$ – Kevin Cruijssen Sep 2 '16 at 12:41
  • \$\begingroup\$ @KevinCruijssen That was unintentional lol. \$\endgroup\$ – Micheal Johnson Sep 2 '16 at 19:52

Brainfuck, 104 bytes

  • 1
    \$\begingroup\$ Practically the same size as Hello World. Impressive! \$\endgroup\$ – phyrfox Aug 10 '16 at 9:00
  • 3
    \$\begingroup\$ @phyrfox Actually... \$\endgroup\$ – Sp3000 Aug 10 '16 at 12:29

Convex, 10 bytes


Try it online!

U               Predefined Variable: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 _(+            Push a copy with the 'A at the end.
    ]           Add both strings to an array.
     D*         Repeat array 13 times. D defaults to 13.
       z        Transpose.
        N*      Join by newlines. N defaults to "\n"

Pyth, 11 10 bytes


Try it here.

        G   the alphabet
       B    bifurcate over
     .<  1  left shift by 1
  *13       repeat 13 times
 C          transpose
j           join on newlines

Vim, 85 83 bytes

:h<_<cr><cr><cr>YZZP:s/./\0\r/g<cr><c+v>ggy25Pqqlxj:let @a='xkPjj'<cr>25@akia<esc>25klq11@qh<ctrl+v>25jylpl<c+v>25jdGdd

I know this can be golfed more, but my head hurts so I gotta stop for now.

<cr> is the enter key, <c+v> is ctrl+v, and <esc> is the escape key. Those were all counted as one byte.

I recorded a gif of this, but it got screwed up. The video is fine though: http://recordit.co/ldLKvho9Gi


Ruby, 42 39 38 37 bytes

-3 bytes thanks to @user81655
-1 byte thanks to @manatwork
-1 byte thanks to @NotthatCharles

?A.upto(?Z){|a|puts (a+a.next[0])*13}

See it on repl.it: https://repl.it/CmOJ


Cheddar, 48 bytes


Cheddar is good with strings :D

Try it online!


  (65|>90)            // Range from 65 (A) to 90 (Z)
  .map(l->            // Map through range
    @"                // Convert following array of char codes to string
      [l,             // The character 
       l>89?65:l+1]   // See below for explanation
      *13             // Repeat 13 times
  ).vfuse             // Vertically fuse

What does l>89?65:l+1 do? Well 89 is the char code for Y. Basically, l>89 is checking if the letter is Z, that means we should be returning A. If l>89 is false. I'll return l+1, the next char

  • \$\begingroup\$ I thought you can insert @" between them. \$\endgroup\$ – Leaky Nun Aug 9 '16 at 23:45
  • \$\begingroup\$ Doesn't this use a function return? \$\endgroup\$ – Conor O'Brien Aug 9 '16 at 23:46
  • \$\begingroup\$ @ConorO'Brien yeah? \$\endgroup\$ – Downgoat Aug 9 '16 at 23:47
  • \$\begingroup\$ codegolf.stackexchange.com/questions/89283/… \$\endgroup\$ – Conor O'Brien Aug 9 '16 at 23:47
  • \$\begingroup\$ @ConorO'Brien oh, didn't see in challenge spec. will fix \$\endgroup\$ – Downgoat Aug 9 '16 at 23:48

Jelly, 10 bytes


Try it online!

How it works

26ḶḂØAṙZj⁷  Main link. No arguments.

26Ḷ         Yield [0, ..., 25].
   Ḃ        Bit; compute the parity of each intger.
    ØAṙ     Rotate the alphabet by these amounts.
       Z    Zip; transpose rows and columns.
        j⁷  Join, separating by linefeeds.
  • \$\begingroup\$ Didn't Y exist back then? Also congrats for 100k rep!! \$\endgroup\$ – Erik the Outgolfer Sep 30 '16 at 15:46
  • \$\begingroup\$ Thanks! I checked and, sadly, Y was added two days after the challenge was posted. \$\endgroup\$ – Dennis Sep 30 '16 at 15:50
  • \$\begingroup\$ Because you could have golfed it further down to 26ḶḂØAṙZY. But, as it is right now, it's still good. \$\endgroup\$ – Erik the Outgolfer Sep 30 '16 at 15:51

Haskell, 60 58 bytes

mapM putStrLn[[0..12]>>[a,b]|a:b:_<-scanr(:)"A"['A'..'Z']]

Starting with "A" scanr(:) builds the a list from the chars of ['A'..'Z'] from the right. (-> ["ABCDE...A", "BCDEF..A", ..., "XYZA", "YZA", "ZA", "A"]). (a:b:_) matches the first two chars of each sublists (with at least two chars) and makes 13 copies of it.

  • \$\begingroup\$ Considering some of the cheats used by other languages on a regular basis I consider it only fair to not include the actual printing. In this case you could replace it with "(++"\n")=<<" and save 2 bytes. Possibly more. \$\endgroup\$ – MarLinn Aug 11 '16 at 5:44
  • \$\begingroup\$ @MarLinn: No, I don't think so. Golfing languages are designed with implicit printing in mind and most other answers do have some sort of printing command. Btw, unlines is even shorter than (++"\n")=<<. \$\endgroup\$ – nimi Aug 11 '16 at 15:37

PowerShell, 49 43 bytes

TimmyD's remix:


was, 49 bytes:


Example output


Python 2, 70 68 54 bytes

List based solution:

for i in range(-26,0):print(L[i]+L[i+1])*13

But why create a list? Thanks LeakyNun:

for i in range(26):print(chr(i+65)+chr(-~i%26+65))*13

R, 72 67 60 56 bytes


Thanks to @Giuseppe for the extra 4 bytes off!

Old rep-based solution at 60 bytes:

for(i in 1:26)cat(rep(LETTERS[c(i,i%%26+1)],13),"\n",sep="")

See here on an online interpreter. Thanks to @user5957401 for the extra 7 bytes off!

Old matrix-based solution at 72 bytes:

for(i in 1:26)cat(matrix(LETTERS[c(1:26,2:26,1)],26,26)[i,],"\n",sep="")

See here on an online interpreter.

  • 1
    \$\begingroup\$ if you change the indext to i in 1:26 and then the letter selection to LETTERS[c(i,i%%26+1)] you can drop like 6 or 7 bytes \$\endgroup\$ – user5957401 Aug 10 '16 at 13:07
  • 1
    \$\begingroup\$ @user5957401 arf I was so stubbornly doing (i+1)%%26 that it didn't occur to me to do the opposite! Thanks! \$\endgroup\$ – plannapus Aug 10 '16 at 13:54
  • 1
    \$\begingroup\$ 56 bytes using matrices again :) \$\endgroup\$ – Giuseppe Sep 13 '17 at 18:23

MATL, 13 bytes


Try it online!

1Y2    % Predefined string literal: 'AB···Z'
tn:    % Duplicate, number of elements, range: gives [1, 2, ···, 26]
!      % Transpose into a column vector
to~!   % Duplicate and transform into [0, 1, 0, 1, ···, 1] using modulo 2
+      % Addition with broadcast. Gives 2D numeric array
)      % Index (modularly) into string. Implicitly display.

Jellyfish, 26 bytes

| S
+$ r2

Note the trailing unprintable characters on the last two lines. Try it online!


This is basically an arithmetic manipulation approach: make a 26×26 grid with alternating 0-1 pattern, add the index of each row to every element of the row, reduce mod 26, and add the ASCII value of A. Characters in Jellyfish are just numbers with a special flag, and all arithmetic works on them as expected.

From bottom to top:

  • The 's are character literals; they are followed by unprintables with ASCII code 26, and stand for those characters.
  • The lower r computes the character range from 0 to 25.
  • The , forms a pair from the two unprintable chars.
  • The higher r is given argument 2, and forms the range [0 1].
  • The $ takes that range, and reshapes it into the shape given by its other argument, which is the pair of unprintables. This gives a 26×26 matrix of alternating rows 0 1 0 1 0 1 ...
  • The lower + adds the char range 0-25 to this matrix. The addition distributes on the rows, so row i is incremented by i. It's also converted to a char matrix, since the south argument consists of chars.
  • The ~| is modulus with flipped arguments: the south argument (the above char matrix) is reduced modulo the east argument (the S turns the argument-seeking process south, so this is the unprintable literal 26).
  • The higher + adds the literal A to every coordinate of the resulting matrix.
  • The P prints the result in matrix format, that is, each row on its own line without quotes.
  • 1
    \$\begingroup\$ I wanted to try to golf but then I saw the name of him who wrote the code. \$\endgroup\$ – Leaky Nun Aug 10 '16 at 8:04
  • \$\begingroup\$ @LeakyNun You can still try! Although 26 bytes is fitting for this challenge. \$\endgroup\$ – Zgarb Aug 10 '16 at 8:26

Vim, 31 bytes


Where is the Return key.

enter image description here


Perl, 26 bytes

Solution from @Dom Hastings. (12 bytes shorter than mine!)
-1 byte thanks to @Ton Hospel

say+($_++,chop)x13for A..Z

Run with -M5.010 or -E :

perl -E 'say+($_++,chop)x13for A..Z'
  • \$\begingroup\$ Managed to get this down to 33: say+($_++,$_--=~/^./g)x13for A..Z, but I'm sure there's a way to get a shorter one from: say+($_++,$_--)x13for A..Z... \$\endgroup\$ – Dom Hastings Aug 10 '16 at 7:36
  • \$\begingroup\$ Not sure why I have the -- in there, it's not needed! O_o. 27: say+($_++,/^./g)x13for A..Z \$\endgroup\$ – Dom Hastings Aug 10 '16 at 7:52
  • \$\begingroup\$ @DomHastings Nicely done! I tried say+($_,$_++)x13for A..Z at first which didn't work, but it seems I should have push further into that direction! \$\endgroup\$ – Dada Aug 10 '16 at 10:42
  • 1
    \$\begingroup\$ say+($_++,chop)x13for A..Z saves one more byte \$\endgroup\$ – Ton Hospel Aug 10 '16 at 14:59
  • \$\begingroup\$ @TonHospel great, thanks for that. \$\endgroup\$ – Dada Aug 10 '16 at 15:17

T-SQL 133 Bytes (Golfed by : @t-clausen.dk)

SELECT REPLICATE(Char(number+65)+IIF(number=25,'A',Char(number+66)),13)FROM spt_values WHERE number<26and'P'=TYPE

T-SQL , 151 Bytes

Using CTE to generate sequence of number


T-SQL, 155 Bytes

SELECT REPLICATE(Char(number+65)+ CASE WHEN number=25 THEN 'A' ELSE Char(number+66) END, 13) FROM master.dbo.spt_values  WHERE name IS NULL AND number < 26
  • \$\begingroup\$ I have golfed your answer down to 113 characters. I provided a very different answer in TSQL \$\endgroup\$ – t-clausen.dk Aug 10 '16 at 15:00
  • \$\begingroup\$ @t-Clausen.dk That is excellent. Please post your answer. I would delete mine. \$\endgroup\$ – Anuj Tripathi Aug 10 '16 at 16:24
  • \$\begingroup\$ no reason to delete your answer, you can just use my fiddle to improve your answer. I already posted 1 hour ago ago, if you enjoy TSQL , you should take a look at my other answers. I made Fiddles for most of them \$\endgroup\$ – t-clausen.dk Aug 10 '16 at 16:38

Julia, 46 bytes

[println("$c$(c+1-26(c>89))"^13)for c='A':'Z']

Try it online!


Pyth, 10 bytes




  m      G    Map over G, predefined to the lowercase alphabet.
              This will give 26 columns.
   .<G        Left shift (cyclically) G by
        Z     Z elements. Z is initialized to 0.
      ~!      After using its value, logical not Z. (0 -> 1, 1 -> 0)
 C            Transpose
j             Join on newlines
  • \$\begingroup\$ Nice, wish I knew as much as you do about Pyth \$\endgroup\$ – Stan Strum Sep 13 '17 at 18:19

Brainfuck, 88 86 bytes


Requires an interpreter with 8-bit cells and a tape not bounded on the left. Try it online!


Lua, 80 65 Bytes.

s = string c = s.char for i=1,26 do print(s.rep(c(64+i)..c((65+(i%26))),13)) end

With help from Leaky Nun

c=("").char for i=1,26 do print((c(64+i)..c(65+i%26)):rep(13))end

Lua is a pretty inefficent language in regards to handling of strings and such, so this is the best I can narrow it down.

  • \$\begingroup\$ Welcome to PPCG! Nice first post! You can save 5 bytes if you remove some unnecessary whitespace: s=string c=s.char for i=1,26 do print(s.rep(c(64+i)..c((65+(i%26))),13))end \$\endgroup\$ – GamrCorps Aug 10 '16 at 3:23
  • \$\begingroup\$ for i=1,26 do print(((64+i):char()..(65+(i%26)):char()):rep(13))end (not tested) \$\endgroup\$ – Leaky Nun Aug 10 '16 at 3:27
  • \$\begingroup\$ Because string.rep(x,13) is basically x:rep(13) \$\endgroup\$ – Leaky Nun Aug 10 '16 at 3:28
  • \$\begingroup\$ Right! I forgot the string metatable defaultly indexes to the string library. \$\endgroup\$ – ATaco Aug 10 '16 at 5:42
  • \$\begingroup\$ Although good, numbers such as 65+(i%26) don't count as strings unless stored as such. I'll work on a way to make that work for the hell of it. \$\endgroup\$ – ATaco Aug 10 '16 at 5:46

Brachylog, 30 24 20 bytes


Try it online!


05AB1E, 12 bytes



AD            # push 2 copies of the alphabet
  À           # rotate the 2nd one left by 1
   )ø         # add to list and zip
     v        # for each
      yJ      # join the pair
        5Ø×   # repeat it 13 times
           ,  # print with newline

Try it online

  • \$\begingroup\$ I know this is an old question but i just can't help myself. ADÀ)ø13×» works as well with 9 bytes. \$\endgroup\$ – Datboi Jun 14 '17 at 20:09
  • \$\begingroup\$ @Datboi: That does indeed work now, but unfortunately it didn't work at the time this question was posted :( \$\endgroup\$ – Emigna Jun 15 '17 at 7:32

Mathematica, 82 75 67 66 bytes


Technically shorter, although it prints in lowercase instead of uppercase:

Mathematica, 64 bytes

  • 1
    \$\begingroup\$ Nice trick using PadLeft. \$\endgroup\$ – Leaky Nun Aug 11 '16 at 2:43

TSQL, 111 bytes

DECLARE @o varchar(702)='',@ int=1WHILE @<702SELECT @o+=CHAR(IIF(@%27=0,10,65+(@/27+1-@%27%2)%26)),@+=1PRINT @o



MATLAB, 47 38 bytes

a=(65:90)';char(repmat([a a([2:end 1])],1,13))

char(repmat([65:90;[66:90 65]]',1,13))

The first makes a column array of the alphabet in ASCII, appends a shifted copy as a column to its right, replicates the resulting 26*2 array 13 times columnwise, casts to a character array and prints by default.

The second makes a 2*26 array of alphabet and shifted alphabet, transposes it then continues as above.

  • \$\begingroup\$ You can save one byte using [... ''] instead of char(...). \$\endgroup\$ – pajonk Aug 10 '16 at 15:56
  • \$\begingroup\$ And you can use simply [65:90;66:90 65] saving two bytes. \$\endgroup\$ – pajonk Aug 10 '16 at 16:02

J, 20 19 bytes

1 byte thanks to miles.


Online interpreter

This is actually the program I used to generate the text in the challenge.

  • \$\begingroup\$ You can remove the @ \$\endgroup\$ – miles Aug 10 '16 at 11:01

Neoscript, 59 bytes

a=('A:[]:'Z)+'Aeach n=0:[]:25console:log((a[n]+a[n+1])*13);

PHP, 102 bytes

<?php $a='ABCDEFGHIJKLMNOPQRSTUVWXYZA';$i=-1;while($i++<25){echo str_repeat(substr($a,$i,2),13)."\n";}
  • \$\begingroup\$ You can remove the quotes from the Alphabet string. Replace \n with an actual enter instead of \n. Stole that idea from @insertusernamehere. So check his answer for what I mean. Edit: Also use the short-tag notation <?. You also do not need a space after <?. So <?$a='ABC' also works. \$\endgroup\$ – Jeroen Aug 15 '16 at 10:40

Ruby, 41 bytes

26.times{|i|puts [*?A..?Z,?A][i,2]*''*13}

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.