Make the Mexican Wave

In as few bytes as possible, write a program or function that outputs the following:

Abcdefghijklmnopqrstuvwxyz
aBcdefghijklmnopqrstuvwxyz
abCdefghijklmnopqrstuvwxyz
abcDefghijklmnopqrstuvwxyz
abcdEfghijklmnopqrstuvwxyz
abcdeFghijklmnopqrstuvwxyz
abcdefGhijklmnopqrstuvwxyz
abcdefgHijklmnopqrstuvwxyz
abcdefghIjklmnopqrstuvwxyz
abcdefghiJklmnopqrstuvwxyz
abcdefghijKlmnopqrstuvwxyz
abcdefghijkLmnopqrstuvwxyz
abcdefghijklMnopqrstuvwxyz
abcdefghijklmNopqrstuvwxyz
abcdefghijklmnOpqrstuvwxyz
abcdefghijklmnoPqrstuvwxyz
abcdefghijklmnopQrstuvwxyz
abcdefghijklmnopqRstuvwxyz
abcdefghijklmnopqrStuvwxyz
abcdefghijklmnopqrsTuvwxyz
abcdefghijklmnopqrstUvwxyz
abcdefghijklmnopqrstuVwxyz
abcdefghijklmnopqrstuvWxyz
abcdefghijklmnopqrstuvwXyz
abcdefghijklmnopqrstuvwxYz
abcdefghijklmnopqrstuvwxyZ
abcdefghijklmnopqrstuvwxYz
abcdefghijklmnopqrstuvwXyz
abcdefghijklmnopqrstuvWxyz
abcdefghijklmnopqrstuVwxyz
abcdefghijklmnopqrstUvwxyz
abcdefghijklmnopqrsTuvwxyz
abcdefghijklmnopqrStuvwxyz
abcdefghijklmnopqRstuvwxyz
abcdefghijklmnopQrstuvwxyz
abcdefghijklmnoPqrstuvwxyz
abcdefghijklmnOpqrstuvwxyz
abcdefghijklmNopqrstuvwxyz
abcdefghijklMnopqrstuvwxyz
abcdefghijkLmnopqrstuvwxyz
abcdefghijKlmnopqrstuvwxyz
abcdefghiJklmnopqrstuvwxyz
abcdefghIjklmnopqrstuvwxyz
abcdefgHijklmnopqrstuvwxyz
abcdefGhijklmnopqrstuvwxyz
abcdeFghijklmnopqrstuvwxyz
abcdEfghijklmnopqrstuvwxyz
abcDefghijklmnopqrstuvwxyz
abCdefghijklmnopqrstuvwxyz
aBcdefghijklmnopqrstuvwxyz
Abcdefghijklmnopqrstuvwxyz

A trailing newline is permitted. You can find a reference ungolfed Python implementation here.

• Is it safe to assume input is never upper case? – Winny Jul 26 '15 at 5:46
• @Winny There is no input. The output is fixed. In fact, that's the general idea of kolmogorov-complexity questions. – Chris Jester-Young Jul 26 '15 at 5:49
• This has been in the HNQ list consistently since you posted it. Nice work. :) – Alex A. Jul 30 '15 at 20:25
• You can find a reference ungolfed Python implementation here. -> link's broken – Franck Dernoncourt Aug 11 '17 at 22:48
• Franck Dernoncourt's point still stands. The link is broken. – Jonathan Frech Jul 25 '18 at 20:18

import Data.Char
a c=take 701(cycle(toUpper:replicate c id))
f=zipWith($)(a 27++drop 27(a 25))$cycle(['a'..'z']++"\n")
g=f++"z"

Not as short as the others but a very different approach. Defines the constant g as the string. save to a file and open interactively using ghci <filename>. Then enter g to the repl.

Python 3, 103 characters

a="abcdefghijklmnopqrstuvwxyz"
for i in range(51):
x=25-abs(25-i)
print(a.replace(a[x],a[x].upper()))
• Why calculating len(abc) 3 times? It will be always 26. See Tips for golfing in Python for a couple of hints to reduce code size. (By the way, the code you posted has only 141 bytes according to UTF-8 string length & byte counter.) – manatwork Feb 9 '16 at 17:39
• You keep being one step behind yourself: you fixed the count as 141 and reduced your code to 121 characters.☺ Given that you use long variable name and unnecessarily deep indentation, Tips for golfing in <all languages> may also give you a few golfing hints. And one hint for this particular case: count from 0. That way you can use range(51) and x=25-abs(25-i), which are shorter. – manatwork Feb 9 '16 at 17:55
• manatwork, thanks for all the advice, i was taking the size displayed at the file system, instead of the character count. – Argenis García Feb 9 '16 at 19:54

Japt v1.4.5 -R, 12 bytes

;C¬ê £CrX,_u

Try it online!

Somehow tied with top Pyth submission.

Unpacked & How it works

;Cq ê mX{CrX,Z{Zu
;                  Use alternative set of initial variables
C                 "abc...z"
q ê              Split into chars and palindromify [a,b,...,z,...,b,a]
mX{          Map...
CrX,Z{Zu    Replace the char X in C into uppercase

-R                 Join with newline

MS-SQL, 135 bytes

WITH t AS(SELECT-25n UNION ALL SELECT n+1FROM t WHERE n<25)SELECT
STUFF('abcdefghijklmnopqrstuvwxyz',26-ABS(n),1,CHAR(90-ABS(n)))FROM t

Inspired largely by MickyT's postgreSQL solution, but since we can't use generate_series, we use a CTE to create a number table, and use STUFF to replace each character.

Yabasic, 93 bytes

An anonymous function that takes no input and outputs to the console.

For i=-25To 25
For j=-25To 0
s$=Chr$(122+j)
If j=-abs(i)Then s$=Upper$(s$)Fi ?s$;
Next
?
Next

Try it online!

Alternate Solution, 93 bytes

For i=-25To 25
For j=-25To 0
s$=Chr$(122+j)
If j+abs(i)Then?s$;Else?Upper$(s\$);Fi
Next
?
Next

Try it online!

Python 2, 107 bytes

a='abcdefghijklmnopqrstuvwxyz'
for c in range(51):
i=25-abs(25-c)
print a[:i]+a[i].upper()+a[i+1:]
• the diagonals go forwards & back in the output. You're only outputting half of the required output. – dzaima Jun 7 '18 at 19:29
• Oh, My bad. Ill edit it – Khalil Jun 8 '18 at 15:59

dc, 83 bytes

97sj1sxBDsy[32-]sU[liddlj=UP1+dsiBD>I]sI[97silIxAPljlx+dsjly!=J]dsJx_1sx96syBBsjlJx

Try it online!

Bit chunkier than I would have liked. Ultimately we're going to use two macros, I and J, and they're going to use some counters, i and j. The counters are decimal values converted to ASCII for printing. Macro I ([liddlj=UP1+dsiBD>I]sI)handles printing one line of the alphabet, letter at a time, checking each letter to see if it matches and running macro U ([32-]sU) to uppercase if need be. It runs until it hits 123, just past the letter 'z'. Macro J ([97silIxAPljlx+dsjly!=J]dsJx) resets i to the beginning of the alphabet, runs I, prints a linebreak (AP), adds the value of x to j, and keeps running as long as it doesn't match the value of y. The first time we run it, x is positive 1 and y is 123, so we increment until we're past the letter 'z'. After doing that, we put j back down to 121 (after ...xyZ we're supposed to print ...xYz and not a second ...xyZ), and set x to negative 1 and y to 96, running J with a decrement and lower bound just below the letter 'a'.

Python 3, 88 bytes

a=list(range(26));[print(''.join([chr([97+x,65+x][x==i])for x in a]))for i in a+a[::-1]]

Try it online!

VBA, 80 bytes

A script that takes no input and outputs to the console.

For i=-25To 25:For j=-25To 0:s=Chr(122+j):?IIf(j+Abs(i),s,UCase(s));:Next:?:Next

Lua, 96 bytes

for j=1,51 do for i=1,26 do io.write(string.char(i+((j+i==52or i==j)and 64or 96)))end print()end

Try it online!

for j=1, 51 do -- a to z (26) + y to a (25), because the Z doesn't repeat
for i=1, 26 do -- for each letter
io.write(string.char(i+((j==52-i or j==i) and 64 or 96))) -- ↴
io.write(string.char(i+(                               )) -- writes the character represented by the value i+(...) on the ASCII table
(j==52-i or j==i)                 -- if the uppercase letter is equal to i or to 52-i
and 64 or 96    -- then sum 64 else sum 96 (because 'A' is 65 and 'a' is 97)
end
print() -- jumps to the next line
end

If you have any questions, feel free to ask!

Excel, 101 bytes

Using Immediate Window and Output in CellA1:A51

[A1:A51]="=SUBSTITUTE(""abcdefghijklmnopqrstuvwxyz"",CHAR(122-ABS(ROW()-26)),CHAR(90-ABS(ROW()-26)))"

05AB1E, 12 9 bytes

AûvAyDu:,

The existing 05AB1E answer got deleted for some reason, so I decided to post a new one.

-3 bytes thanks to @dzaima.

Try it online.

Explanation:

A           # Push the lowercase alphabet: "abcdefghijklmnopqrstuvwxyz"
û          # Palindromize it: "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"
v         # Loop over each of its characters y
A        #  Push the lowercase alphabet
y  :    #  Replace the current lowercase letter y,
Du     #  with it's uppercase variant
,   #  Print the modified alphabet with trailing newline

;C¬£ChYXuÃê

Test it