Print "Hey Jude" from The Beatles

JavaScript (ES6), 108 bytes

a=>`01
4
9bc
efgjk

02
567
abd
efijk

03
587
9bc
efgjk

01
4
9bd
efhij

`.replace(/./g,n=>a[parseInt(n,36)])

Try it online!


Alternate version, 114 bytes

A slightly better compression, but sadly ruined by the larger decompression code.

a=>`835fc3cbbd3
84db3db4bbdb3
85cd1cc3cbbd3
835fc4bbcb3

`.replace(/./g,n=>a[n='0x'+n,i=n%8&&n%8-2+i]+[`
`[n>>3]])

Try it online!


Jelly, 42 bytes

;⁷“Ṙç€ṘḋḷŒø|Ṁ2kḤ⁽⁼SƁẒVṿẎj]ð⁵ṀƒƤ)÷Ƒ¦Ẋ½Iɠ⁻’ṃ

Try it online!

Hardcoding version.

Input:

["Hey Jude, don't", ' make it bad', 'Take a sad song and make it better', 'Remember to', ' let her', ' into your heart', 'Then', ' you', ' can start', ' to make it', ' better', ' be afraid', 'You', ' were made to go out', ' and get her', 'The minute you', ' under your skin', ' begin', ' let me down', ' have found her, now go', "'ll"]

Ruby + -p, 177 136 120 118 115 109 bytes (full program)

$_="abvevjlmvopqtuvvacvfghvklnvopstuvvadvfihvjlmvopqtuvvabvevjlnvoprstv".gsub(/./){|c|(eval$_)[c.ord-97]||$/}

Try it online!

-41 bytes: Switch from using variables to using characters as array indexes

-16 bytes: Switch to a more convenient input format

-1 byte: No space needed between puts and "abv...

-1 byte: Use $/ global instead of ?\n literal

-3 bytes: Use gsub(/./) instead of .chars.map

-6 bytes: Call with -p and make use of $_. Thanks Pavel!

Each character in the magic string represents an index into the input array. I need the variable z so that I only read from STDIN once.

I could save some cost from IO by writing a lambda accepting an array and returning a string. This requires an extra v at the end, because it's not getting a free newline from -p.

Ruby, 162 110 108 105 bytes (function)

->z{"abvevjlmvopqtuvvacvfghvklnvopstuvvadvfihvjlmvopqtuvvabvevjlnvoprstvv".gsub(/./){|c|z[c.ord-97]||$/}}

Try it online!