Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley.

Rules:

  • Must output the lyrics exactly as they appear in the above pastebin. Here's the raw dump: http://pastebin.com/raw/wwvdjvEj
  • Cannot rely on any external resources - all lyrics must be generated by / embedded in code.
  • No use of existing compression algorithms (e.g. gzip / bzip2) unless you include the full algorithm in your code.
  • Use any language, shortest code wins.

Update, 1st June 2012:
For solutions containing non-ASCII text, the size of your solution will be counted in bytes, based on UTF-8 encoding. If you use codepoints that cannot be encoded in UTF-8, your solution will not be judged as valid.

Update, 7th June 2012:
Thank you all for your awesome solutions! I'll be accepting the shortest answer tomorrow afternoon. Right now, Peter Taylor's GolfScript answer is winning, so get cracking on some improvements if you want to beat him! :)

  • 4
    @w0lf You're correct. I only scanned the lyrics to verify their accuracy, I must've missed that one. I'll accept either "know" or "known". – Polynomial May 29 '12 at 7:30
  • 9
    26k+ views in just 3 days. WOW... – Gaffi Jun 1 '12 at 21:30
  • 9
    How in the world did this generate so many views and votes? Whatever he did, I'm going to reverse engineer it. – PhiNotPi Jun 2 '12 at 21:27
  • 36
    @PhiNotPi Good luck reverse engineering "Jeff Atwood tweeting you". – breadbox Jun 3 '12 at 8:04
  • 7
    The restriction with UTF-8 makes no sense. What if my code is shorter when encoded as UTF-16 or as Latin-1? You should either count the number of bytes or the number of characters, but leave the encoding up to the author. – Timwi Jan 25 '14 at 0:22

58 Answers 58

Java - 903 Bytes

Here is my Java take at it, no compression algorithms used, just a dictionary.

In a single line:

class R {static String n(String w){return "Never gonna "+w+"\n";}public static void main(String[] args){String d[]={"(Ooh, give you up)\n","(Ooh)\n",n("give you up")+n("let you down")+n("run around and desert you")+n("make you cry")+n("say goodbye")+n("tell a lie and hurt you")+"\n","(Give you up)\n",n("give, never gonna give"),"We've known each other for so long\nYour heart's been aching but\nYou're too shy to say it\nInside we both know what's been going on\nWe know the game and we're gonna play it\n","\nI just wanna tell you how I'm feeling\nGotta make you understand\n\n","We're no strangers to love\nYou know the rules and so do I\nA full commitment's what I'm thinking of\nYou wouldn't get this from any other guy","And if you ask me how I'm feeling\nDon't tell me you're too blind to see\n\n","\n"};int n[]={7,6,2,5,8,2,2,0,0,1,4,3,1,4,3,9,5,6,2,2,2};for(int i:n){System.out.print(d[i]);}}}

And pretty printed for readability

class R {
    static String n(String w) {
        return "Never gonna " + w + "\n";
    }

    public static void main(String[] args) {
        String d[] = {"(Ooh, give you up)\n",
                "(Ooh)\n",
                n("give you up") +
                        n("let you down") +
                        n("run around and desert you") +
                        n("make you cry") +
                        n("say goodbye") +
                        n("tell a lie and hurt you") +
                        "\n",
                "(Give you up)\n",
                n("give, never gonna give"),
                "We've known each other for so long\nYour heart's been aching but\nYou're too shy to say it\nInside we both know what's been going on\nWe know the game and we're gonna play it\n",
                "\nI just wanna tell you how I'm feeling\nGotta make you understand\n\n",
                "We're no strangers to love\nYou know the rules and so do I\nA full commitment's what I'm thinking of\nYou wouldn't get this from any other guy",
                "And if you ask me how I'm feeling\nDon't tell me you're too blind to see\n\n",
                "\n"
        };
        int n[] = {7, 6, 2, 5, 8, 2, 2, 0, 0, 1, 4, 3, 1, 4, 3, 9, 5, 6, 2, 2, 2};
        for (int i : n) {
            System.out.print(d[i]);
        }
    }
}

Ruby (549) binary chars

I recently found that you can enter arbitrary binary characters (including those with value between 128 and 255) in ruby strings, as long as you follow some simple ruby escaping rules. Packing information into binary enables more efficient compression. Unfortunately, display of the "code", when written in binary, is problematic; thus, I created a generic program that reads in an existing ruby text program (assumed to not use chars with value > 127), and creates a secondary ruby source code that does exactly the same thing. This secondary code uses one long string with binary characters in it, and can be shorter than the original, in terms of number of bytes.

Here is the source "code-packer.rb"; it transforms input ruby source code into equivalent "compressed" output ruby source code. All it really does is binary packing of the original source code string, along with printing code for binary unpacking of the binary string.

Addendum: It appears that the original code-packer produces code that does not represent valid UTF-8 encoded binary strings, and thus is technically invalid according to the rules. To make it valid, we must use only character values up to 128. I recently read the UTF-8 encoding rules, and trying to use all 8 bits and generate UTF-encoded strings is not fruitful because most binary strings (over half of all possibly binary strings of any given length) will not represent valid UTF-8 encodings. So using straight up 7-bit ascii code is more efficient. I've modified the code-packer code below to produce only unreadable 7-bit ascii strings by replacing "256" with "128" and "<<8" with "<<7". This makes the packing compression idea not worthwhile for small programs (< 700 or so bytes), although it does still reduce Actven's 1000+ byte solution down to 937 bytes.

#!/usr/bin/env ruby
# This program takes a ruby file as input
# and outputs an equivalent ruby file as output that
# is functionally equivalent, but "compressed". 
# Compression is done by creating a string representing the original program
# which contains unprintable characters (including chars with value between 128 and 255)
# The string is just a binary packed version of the input program text.
# 
# the "decompression" algorithm for the string is written in ruby as part of the output, 
# along with an eval on the decompressed string. 
# NOTE: assumes input file doesn't contain any unprintable chars with value > 126, otherwise this will fail.

DEBUG=false # turn on debug to produce larger code that uses code sequences for the unprintable characters, 
         # and prints debugging information, and ruby code instead of executing it.
#DEBUG=true

# returns array of frequency counts for str
def frequency_count(str)
  freq= Array.new(127,0)
  str.bytes {|b| freq[b]+=1}
  freq
end

# figure out an appropriate contiguous
# range of characters (via ASCII) to use for representing str. 
# returns 
#  1) forward hash of chars, when applied to str, give only chars in the range
#  2) backward hash of chars for undoing #1
#  3) start character of range
#  4) length of range
def translate_range(str)
  freq = frequency_count(str)
  forward_hash = {}
  backward_hash = {}
  left_index = 0
  right_index = 126

  # ignore unused top range
  while right_index > 0 && freq[right_index] == 0
    right_index -= 1
  end

  if right_index == -1
    raise "Error: empty input string"
  end
  last_char_index = right_index

  # figure out chars to swap to get contiguous range
  # we want to minimize number of swaps, so this
  # naive approach won't always yield the best results.
  while left_index < right_index do
    if freq[left_index] == 0
       left_index += 1
       next
    end

    if freq[right_index] > 0
       right_index -= 1
       next
    end

    # found char on left that can move to empty spot on right
    forward_hash[left_index] = right_index
    backward_hash[right_index] = left_index
    freq[right_index] = 1 # mark it as filled.
    left_index +=1
    right_index -=1
  end 

  while freq[left_index]== 0
     left_index +=1
  end

  [forward_hash, backward_hash, left_index, last_char_index - left_index + 1]
end

# translates text into big num of given base, assuming all chars in string
# are in range start_char..(start_char+base-1)
def text_to_num (str, start_char, base)
   num = 0
   if (str[0] == start_char)
     raise "Sorry.. I can't handle strings that start with #{start_char.chr}"
   end  
   str.reverse.bytes {|x| num = num * base + (x - start_char)}
   num
end

# translates back from num to text. 
def num_to_text (num, start_char, base)
   text = ""
   while num > 0 do
      text += (num % base + start_char).chr
      num /= base
   end
  text
end

# translates from packed num string to original string, without translation part
# will be output into code.. present here for testing.
def packed_num_decode(str, start_char, base)
    m=0;str.bytes{|x|m=(m<<8)+x}
    t=""
    while m>0 ; t+=(m%base+start_char).chr;m/=base end
    t
end

# takes a string used for input into translate, and escapes
# chars with special meaning (^ at beginning, '-' between two chars, backslash)
def tr_escapes(str)
   str.sub("\\","\\\\\\\\").sub(/^\^/,"\\^").sub(/(.)-(.)/m, "\\1\\-\\2")
end

# takes a binary string, and escapes out characters problematic
# when writing the string within single quotes. 
# this includes ' and \.
def packed_string_escapes(str)
  chars_to_escape = "\\\'"
  escaped_str = ""
  str.bytes {|b| if chars_to_escape.include?(b.chr) 
    then
       escaped_str += "\\" + b.chr
    else
       escaped_str += b.chr
    end
  }
  escaped_str 
end

#======== Main program ========
if (ARGV.length != 2)
   puts "Usage: #{__FILE__} <input program> <output program>"
end
inputfile = ARGV[0] 
outputfile = ARGV[1]

inputtext = File.read(inputfile)
input_info = translate_range(inputtext)

from = ""
to = ""
input_info[0].each_pair {|x,y| from += x.chr ; to += y.chr }
input_mod = inputtext.tr(tr_escapes(from), tr_escapes(to))

input_num = text_to_num(input_mod, input_info[2], input_info[3])

packed_num = num_to_text(input_num,0,128).reverse # do reverse so decompression code doesn't have to do it.


if (DEBUG) then 
   pretext="input_mod=#{input_mod.inspect}\nfrom=#{from.inspect}\nto=#{to.inspect}\n"
   packed_num_with_quotes = packed_num.inspect
   operation = "puts \"t=\#\{t.inspect\}\";puts"
else
   pretext=""
   packed_num_with_quotes = "'" +  packed_string_escapes(packed_num) + "'"
   operation = "eval"
end

start_char = input_info[2]
base = input_info[3]
from = ""
to = ""
input_info[1].each_pair {|x,y| from += x.chr ; to += y.chr }

from_str = tr_escapes(from).inspect
to_str = tr_escapes(to).inspect

File.open(outputfile, "w+") {|f|f.puts("#{pretext}m=0;#{packed_num_with_quotes}.bytes{|x|m<<=7;m+=x};" +
              "t=\"\";while m>0;t+=(m%#{base}+#{start_char}).chr;m/=#{base} end;" +
              "#{operation} t.tr(#{from_str},#{to_str})")}

Although the above can be applied to any ruby code (and could be modified to work with other languages), I've applied it to the following short 556 char solution:

i=47
puts"W> n:trangMsL;loT96Ke rules8s;d;I
AJull commit7nt'sHhatVKink= of9HXldn'tRetKisJrom?nyERuy02A@ ifC?sk 75DS'tLU 7C>Lo;bli@L:ee11
O,R4)O,R334)2011|
I justHannaLUC5Gotta Bu@Msta@1|
Ng4NletC downNrun?rX@8desMtCNBcryNsayRoodbyeNtU? lie8hurtC|

W'T6n eachEJor s;lSg9r hear<?ch= but9>Lo:hyL:FInsideHe both6Hha<Ro= S
W6KeRa78we>QplF|4)O)NgiT, nPgiT
(G|iTC up| howVJeel=
| know|me|?@ |
YX|;s|o |t's been|ing|'re| a|nd|A|makeC | yX|D| othM|ay it
|G| w|I| f|Lh| t|er|
NP|
(Ooh|eTrQ|RSna | g|on|ve|ell| I'm|We|ou".split("|").inject{|m,o|m.gsub((i+=1).chr,o)}

The short 556 character solution above is essentially my previous solution, with substitution characters changed, so that the binary packing works better.

If you run the original code-packer program on the above short solution, it will generate a solution that is valid ruby source code that is 549 bytes long. Running this generated ruby source code will print out the required lyrics. Note that although the compressed string is over 100 bytes shorter than the original program, most of the savings is taken up by the decompression code.

If you run the current code-packer program on the above short solution, you get an expansion to 627 bytes. The packed string itself is about 50 bytes shorter, but adding the decompression code blows up the overall size.

Thanks to the commenters for pointing out the technicalities of UTF-8 encoding. To me, the "valid UTF-8" restriction seems rather arbitrary-- if you're going to allow unprintable ascii characters in valid code, why shouldn't you also allow "invalidly coded UTF-8 characters?" The original code-packer still does generate valid ruby source code that really takes up only 549 bytes of storage when run on the 556-byte solution presented above.

  • Is the packed code valid UTF8? – a sad dude Jun 6 '12 at 7:33
  • Check the problem description. Your byte values between 128 and 255 have to be measured as UTF-8-encoded -- in other words as taking up two bytes each. (This rule change is why I had to withdraw my solution.) – breadbox Jun 6 '12 at 12:22

Python 2.7, 845 bytes

Encodes words and then lines as ASCII characters.

w="\n|gonna|you|Never|and|give||tell|make|say|goodbye|a|desert|lie|up|hurt|down|let|run|cry|know|around|it|been|I'm|to|up)|the|so|I|other|how|feeling|too|(Ooh)|play|aching|heart's|You|Your|understand|but|what's|both|we're|long|We've|wanna|on|never|Inside|we|for|give,|each|shy|game|(Ooh,|Gotta|me|(Give|going|We|just|You're|what|A|no|if|any|this|And|known|commitment's|from|you're|love|blind|wouldn't|of|ask|do|full|strangers|see|guy|Don't|rules|get|thinking|We're|*".split("|")
o="!UVN7M:`S!&$4%3!cDZ<,9!&$+%6!jg%s^B;C!&$XT$(!y*^nDp<w!&$,-!@bR*%B;C!Q7YAW?P!I7>z'?t@!]+%K!euld;|r!&$(%1!E!_%=!Iq{imhAx!}fv<o!\(%=!&$*.0'2%!JH:GL!&$58'/%!QkYAW?P!a7>['O$F9!"
l="5.04,/#1%9'+7#:8&$;(*#1%9'+7#1%9'+7#662)32)3#-8&$;#,/#1%9'+7#1%9'+7#1%9'+7"
print "\n".join([[" ".join(["".join(w[ord(p)-35]) for p in k]) for k in o.split("!")][ord(m)-35] for m in l])
  • I think this is incomplete; it seems to miss the first two paragraphs – Cristian Lupascu Jun 1 '12 at 20:42

CoffeeScript, 1054 1047 bytes

Uses a Burrows-Wheeler transform and simple run-length encoding and prints out the lyrics to the console.

c=d='';n=1
for b in "w3tol6nnd6e6seemn6us4oeegglu6d6ou6wnm3rrsAeet,,a10nnr22eer18y6r3euud7y4IIe3uhhea12o3a8kl,,eg3hhyaaea12o5drroa6taaw3mtsyyde3u12tteeddswwufe6t6lle13t12I4e3u3t5nnee/6p4h4e4)3/utuedudu)uItg3/ytt/6))p6u6n6y6e6nn//efttgg/3((/4 5/40(4//|/8n16 6n6ttn22ee  m8gg 15ttrww 7ee h3s6llss 9d6a4 7n25o6iinn 6l 7i6mmwwhhrrmvWWvrhr3ddk8v10mwwW3v4ey6v  hhsf3b4e3t9e4mhhv40hgdds6ld6gl6N8nnN30io 7n10  n 64ttcco4w3t3  t3cctt 9s4l6 lhhkool3hh 4mgGgGg10  sa8n 7l10ppuu 12be9ue3 3o'4 8aa  tmoeeu6weedow6oon44u6a12Aaia4uu  i8ooaio42aa k7IIeados3t4oono6 O4ggrcD  llg42t3g6ffbb 3GGy15Yy12YyYYy11wr6YYylh3n7d6u10  e43uuoot'6fa6e3u5e6uaa 7c6e'4ir' 9e6  nna 3uurr a''esse6r14aani4uuttss 9oo 3o3  i 7so46rfr6o6 12ooh6jjbbgo''i14oe40o9 9o7 a10nhhur6b6 40u"
 x=b.charCodeAt 0
 if x<48||x>57
  d+=c for r in [1..n]
  c=b;n=1
 else if n==1
  n=b
 else
  n+=b
d+=c for r in [1..n]
t=[];l=d.length
for i in [1..l]
 t[j]=d[j]+(t[j] ? '') for j in [0...l]
 t.sort()
for i in [0...l]
 if t[i][l-1]=='|'
  console.log t[i][0..-2].replace /\//g,"\n"

///, 692 682 666 656 bytes

666 bytes lol.

/1/ know //+/ you//>/You//=/Never gonna //!/I just wanna tell+ how I'm feeling
Gotta make+ understand
//@/=give+ up
=let+ down
=run around and desert+
=make+ cry
=say goodbye
=tell a lie and hurt+
//#/We've1each other for so long
>r heart's been aching but
>'re too shy to say it
Inside we both1what's been going on
We1the game and we're gonna play it//%/(Ooh, give+ up)//&/(Ooh)//*/=give, never gonna give//-/(Give+ up)/We're no strangers to love
>1the rules and so do I
A full commitment's what I'm thinking of
> wouldn't get this from any other guy
!
@
#
And if+ ask me how I'm feeling
Don't tell me+'re too blind to see

@
@
%
%
&
*
-
&
*
-

#

!
@
@
@

-10 bytes thanks to Flp.Tkc/Erik the Outgolfer

Try it online!

  • Could you try replacing 'know'? (It's used 4 times, I think) – FlipTack Dec 23 '16 at 10:42
  • Actually, you should be replacing " know ", not "know". – Erik the Outgolfer Dec 23 '16 at 14:37
  • I think it would save 2 bytes to replace o . – Comrade SparklePony Mar 24 '17 at 21:23

Delphi/Pascal. Some issues with casing though. WIP. 1018 characters, including unnecessary whitespace.

program X;
{$APPTYPE CONSOLE}
const
 w:array[32..114] of string = (#10,'(Give','(Ooh)','(Ooh,','A','aching','and','any','around','ask','been','blind','both','but','commitment''s','cry','desert','do','Don''t','down','each','feeling','for','from','full','game','get','give','give,','going','gonna','goodbye','Gotta','guy','heart''s','how','hurt','I','if','I''m','Inside','it','just','know','known','let','lie','long','love','make','me','Never','no','of','on','other','play','rules','run','say','see','shy','so','strangers','tell','the','thinking','this','to','too','understand','up','up)','wanna','we','We''re','We''ve','what','what''s','wouldn''t','You','Your','You''re');
 c='S>;pg S>Mp3 S>Z(&0p S>Qp/ S>[? S>`$N&Dp  ';
 x='kT_dP pKaY&^1E $8.mGbU po:c7''WA EJi`pCG5 @Qpf  '+c+'lL4W6^O qB*%- re]d[I Hj,Kn*=V jKa9&k>XI &Fp)RCG5 2`Rre+d\  '+c+c+  '#;ph #;ph " S><S>; !ph " S><S>; !ph  lK4W6^O qB*%- re]d[I Hj,Kn*=V jKa9&k>XI  EJi`pCG5 @Qpf  '+c+c+c;
var i: Integer;
begin
 for i := 1 to Length(x) do
  write(w[Ord(x[i])]+' ');
end.

Just for fun, here is the start of sub routine for an excel macro that will spit out a text file after building the song into a spreadsheet and then deleting the spreadsheet. Just thought it would be fun. I figure I can reduce the code later. Just make sure you are using 2007 or above and save the initial spreadsheet as an .xlsm

Sub R()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = "R"
With Sheets("R")
.Cells(1, 1) = "We're no strangers to love"
.Cells(2, 1) = "You know the rules and so do I"
.Cells(3, 1) = "A full commitment's what I'm thinking of"
.Cells(4, 1) = "you wouldn't get this from any other guy"
.Cells(5, 1) = "I just wanna tell you how I'm feeling"
.Cells(6, 1) = "Gotta make you understand"
g = "Never gonna"
.Cells(8, 1) = g & " give you up"
.Cells(9, 1) = g & " let you down"
.Cells(10, 1) = g & " run around and desert you"
.Cells(11, 1) = g & " make you cry"
.Cells(12, 1) = g & " say goodbye"
.Cells(13, 1) = g & " tell a lie and hurt you"
.Cells(23, 1).Resize(7, 1) = .Cells(8, 1).Resize(7, 1).Value
.Cells(30, 1).Resize(7, 1) = .Cells(8, 1).Resize(7, 1).Value
.Cells(55, 1).Resize(7, 1) = .Cells(8, 1).Resize(7, 1).Value
.Cells(62, 1).Resize(7, 1) = .Cells(8, 1).Resize(7, 1).Value
.Cells(69, 1).Resize(7, 1) = .Cells(8, 1).Resize(7, 1).Value
.Cells(15, 1) = "We've known each other for so long"
.Cells(16, 1) = "Your heart's been aching but"
.Cells(17, 1) = "you're too shy to say it"
.Cells(18, 1) = "Inside we both know what's been going on"
.Cells(19, 1) = "We know the game and we're gonna play it"
.Cells(20, 1) = "And if you ask me how I'm feeling"
.Cells(21, 1) = "Don't tell me you're too blind to see"
.Cells(37, 1) = "(Ooh, give you up)"
.Cells(38, 1) = .Cells(37, 1)
.Cells(39, 1) = "(Ooh)"
 x = "Never gonna give"
.Cells(40, 1) = x & "," & x
.Cells(41, 1) = "(Give you up)"
.Cells(42, 1) = "(Ooh)"
.Cells(43, 1).Resize(2, 1) = Cells(40, 1).Resize(2, 1).Value
.Cells(46, 1).Resize(5, 1) = Cells(15, 1).Resize(5, 1).Value
.Cells(52, 1).Resize(2, 1) = Cells(5, 1).Resize(2, 1).Value
End With
sf = Left(ThisWorkbook.Name, InStr(ThisWorkbook.Name, ".xlsm") - 1) & Format(Now(), "_YYYY_MM_DD") & Format(Now(), "_HH_MM_SS") & ".txt"
iu = FreeFile
Open ThisWorkbook.Path & "\" & sf For Output As #iu
    With Sheets("R")
    For rr = 1 To 75
        Print #iu, .Cells(rr, 1).Text
    Next
    End With
    Close iu
sp= ThisWorkbook.Path & "\" & sf
ro = Shell("notepad.exe " & sp, vbNormalFocus)
    Sheets("R").Select
    ActiveWindow.SelectedSheets.Delete
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Dart. 802b

Live Online App (press play)

http://try.dartlang.org/s/9mJD

My approach

Uses no compression libraries.

  1. The starting string is the lyrics with all duplicate words removed, then split by ' ' into a list.
  2. I create 3 strings (4 in the super optimized version), each char is an ascii lookup in the list.
  3. The final string injects the first two at various points, using string interpolation.
  4. The final string is converted into char codes and used to perform the look ups in the word list.

Verbose Code

void main() {
  var x="We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of wouldn't get this from any other guy just wanna tell you how feeling Gotta make understand Never gonna give up let down run around desert cry say goodbye a lie hurt We've known each for long Your heart's been aching but You're too shy it Inside we both what's going on We game we're play And if ask me Don't you're blind see (Ooh, up) (Ooh) give, never (Give".split(' ');
  var c="DEF>G~DEH>I~DEJK)L>~DEB>M~DENO~DE=PQ)R>~~";
  var d="STU9V*W~XYZ[\\~]^_#N`~abc&dZef~g&'h)iEj`~";
  var a=' !"#\$~%&\'()*+,~-./0123~%456789:~,;<=>?1@~AB>C~~$c${d}kl>mn?1@~o=np^q#r~~$c${c}sF>t~sF>t~u~DEvDEF~x>t~u~DEvDEF~x>t~~$d~,;<=>?1@~AB>C~~$c$c$c';
  var o='';
  a.charCodes().forEach((i) => o += i == 126 ? '\n' : '${x[i-32]} ');
  print(o);
}

Minimized Version

https://gist.github.com/2854180

PHP - 568 570 567 bytes / 552 characters

first: thank you for the competition, it was a nice challange even if I wount win with this solutions in this stage.

based on the PHP-ideas obove but even very efficient I think:

<?=str_replace(range('-',_),split(q,"
2=5letFdown5run arUndCdese@5:cry5sayVoodbye5Da liAhu@q

[e'SJn each<for sQlongLr hear;achO but\9shyGK
]nside we boTBwha;goEn
[e8gamAweM>plKq
] just wRna?H1Yotta :understRdq3)2, n4
(Yq howIfeelO
q
Z4q6Pq7giSq
Z7qiS=)qeSr>qBTe qUMNQqmakeFqt's been q oTer qFupqVonna q Dqrt HqeCqJ q Rd qtell qO oq H qN sqyUq I'm q knowqay itq\Uq'req toqingq
(Oohqo qanqveqthqouq gq
AqDqGqNqWq
YqI"),"[eM nQstrRgersN loSL8rulesCsQdQ]W full commitment's whatITinkEfL wUldn'tVet Tis from Ry<guy/-.Wnd ifFask me1Xon't?me y9blindGee--
P,V3,V006.
/---");

any hints?

  • I'm getting a count of < 500 bytes from your entry. You probably have code formatting mistakes with "<" and ">" – Ed H. Jun 7 '12 at 9:25
  • just fixed the code and tested it again: now it should work :) – Sebastian Apprecht Jun 8 '12 at 7:48
  • Underscores don't need quotes. range('-',_) will work just fine. Also the trailing ?> is not necessary, instead just use a semi-colon. Unfortunately, that still leaves you at 567 bytes, counting necessary newlines. – primo Jun 8 '12 at 7:59
  • I'd really like to see a PHP submission win ;) You should be able to extend your range back to range('%',_) which should give you ~4 more usable keys to switch (, ' and one of () would likely need to be replaced with itself). – primo Jun 8 '12 at 13:26
  • thank you for the ideas primo, I've tried this out in an earlier version but I dont need the more keys (they cost more space than they are eliminating). At the moment I'm playing with another algorithm of replacement (the actual one does not include the efficency of an replacement). The replacement of the capitals is actually very "expensive" - if someone has here a good idea I'll try this out. – Sebastian Apprecht Jun 8 '12 at 21:07

JavaScript 616 bytes

_="cCsole.log(\"We'r:n6strJgKs46lo950P:ruleLQs6d6I*A fuFcommitment'LwhatRPink< of5 wMldn'tEetPiLfrom Jy=guy&>n$A2if?ask me1DC't4eFme-@bli2t6see!!*7,E/)7,E++/)>$&!!\");!*%g/%let?down%run arM2QdesKt-%Hcry%sayEoodbye%teFa li:Qhurt-$ each=for s6lCg5r hear8ach< but5@shy46sBInsid:w:both0 wha8go< C*We0P:gam:Qwe're3plB%*NS&*I just wJna4ell-1Gotta HundKstJd!*\\n+/)7)%gi9, nSgi9*(G?yM/i9?up0 know1 howR feel<*2nd 3ECna 4 t5*YM6o 7*(Ooh8t'Lbeen 9ve:e <ing= othK >**We'90?- @'re4o6Bay it*ConE gFll Hmake?JanKerLs MouP4hQa2R I'mSe9r3";for(Y in $="SRQPMLKJHFECB@?>=<:9876543210/-+*&%$!")with(_.split($[Y]))_=join(pop());eval(_)

@tkazec, I tip my hat off to you... I don't think I could have brought it any lower...

Perl - 706 699 characters.

Completely safe to cut+paste :)

Did the encoding by eye, should be possible to get a better ratio if I get around to doing some statistical analysis.

$_=q{$_="Fn3strSgersMlovez1C P rules ~s3W IzTfull commitmentXwhatNthYkYg ofz1wouldn'UgeUthis from SyOguyDAn5~if 1askL8Wn'U%L9blYdMsee00z22==A5D00zz"V=Qz64, 64q4 1RVDzI jusUwSnT% 18gottTmakZ1understSd0V2Q, 4 1RVQqoohV0z04 1R0leU1Wwn0run aroun_~deserUJ0makZ1cry0say goodbye0% TliZ~hurUJV%tellV0z6V1J V4giveV5 eachOfor s3longzJr heart!achYg butz9shyMsBYsidZK both C what!goYg onzK C P gamZ~F7plBV~S_V6never 7V_d V7gonnTV!Xbeen VX's VWdoV8howNfeelYgzV9J'rZto3VAzzK'vZCVBay itzVCknowVFK'rZVJyouVKweVYinVL mZVM t3V3o VN I'm VO oPr VZe VPtheVRupVSanVTa VUt Eq([^zq])([^zq]+)/"\r\n(".H."$2)"Ez(\(?[^z]?)/"\r\n".HE(^.)/H;};s'H'uc($1)'g;s:V(.):;G$1/:g;s:E:;eG:g;s:(e?)G(.+?)/(.+?);:;s/$2/$3/g$1;:g;eval;print

PHP - 802 bytes and Python - 795 780 bytes

Below is a PHP script that downloads the lyrics, compresses them using a naive implementation of LZSS and then outputs the compressed string together with some decompression code (802 bytes).

$in = file_get_contents("http://pastebin.com/raw.php?i=wwvdjvEj");
$compressed_string = '';
$inc = true;

for ($i = 0; $i < strlen($in); $i++) {
    $offset = 0;
    $length = 0;

    for ($j = 1; $j < strlen($in) - $i + 1; $j++) {
        if (($os = strpos(substr($in, 0, $i), substr($in, $i, $j))) !== false) {
            $offset = $os;
            $length = $j;
        } elseif ($length > 0) {
            break;
        } else { 
            $length = 0;
            break;
        }
    }   

    if ($length > 0) {
        $rep = '';
        if (!$inc) {
            $rep = '>';
        } 

        $rep .= $offset . '|' . $length;

        if (strlen($rep) < $length) {
            $compressed_string .= $rep;
            $i += $length - 1;
            $inc = false;
            continue;
        }
    }

    $compressed_string .= substr($in, $i, 1);
    $inc = true;
}

echo '<?$f="' . $compressed_string . '";do$f=preg_replace_callback(\'/>?(\d+)\|(\d+)/\',create_function(\'$m\',\'global$f;return substr($f,$m[1],$m[2]);\'),$f,1,$c);while($c);echo$f;';

And this is the output:

<?$f="We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of26|6wouldn't get this from any other guy
I just wanna tell you how84|5feeling
Gotta make you understand

Never gonna giv192|7p210|14let you down210|14run around46|5desert you210|14>189|9cry210|14say goodbye210|14tell a lie46|5hu294|8
We've31|5n each132|7for so long26|5r heart's been aching but26|5're too shy to say it
Inside we both31|6wha437|9go94|5n
W396|6 the gam374|6w1|5gonna pl477|7And if you ask me165|18Don't156|6me y459|10blind to see208|184>212|180(Ooh,223|12)1002|20
(Ooh)210|18, n213|15
(G1031|58>1011|13>390|12>403|165>142|250>644|356";do$f=preg_replace_callback('/>?(\d+)\|(\d+)/',create_function('$m','global$f;return substr($f,$m[1],$m[2]);'),$f,1,$c);while($c);echo$f;

Based on the same idea, I also made this Python script, which is slightly smaller than the PHP version.

import re
p=0
s="""We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of26|5wouldn't get this from any other guy
I just wanna tell you how82|5feeling
Gotta make you understand

Never gonna giv187|7p204|13let you down204|13run around45|5desert you204|13>184|9cry204|13say goodbye204|13tell a lie45|5hu285|7
We've30|5n each129|7for so long
Your heart's been aching but
You2|4too shy to say it
Inside we both30|6wha422|9go92|5n
W382|6 the gam362|6w1|5gonna pl461|6And if you ask me161|17Don't152|6me y443|10blind to see203|175>205|173(Ooh,216|12)967|19
(Ooh)204|17, n206|15
(G994|55>975|12>377|11>389|160>139|239>622|345"""
while p!=s:p=s;s=re.sub('>?(\d+)\|(\d+)',lambda m:s[int(m.group(1)):int(m.group(1))+int(m.group(2))],s,1)
print s

C - 890 Characters

I haven't seen many C ones so I thought I'd do one. This is my first attempt and I know it's not the shortest but was interesting to do and works. This is basic word compression but trying not to have any delimiters in the dictionary to save space. A bit of recursion and a few macros just to mix it up a bit! Unfortunately I now know the lyrics by heart and can't get the tune out of my head!

char m[20];   char*t="aIAuptoitsoWeweonmeofnoifdoanyyouandsayrunlieletcryup)I'mtoothehowYoushyforbutseeguygetaskAndgivetellmakeknowhurtdownbeenYourplaylongjustgameeachboth(OohwhatthislovefullfromotherNevergonnaWe'vewe'rewannaneverGottagoing(Ooh)(GiveWe'rerulesNeverknownDon'tblinddesertaroundYou'rewhat'sInsideachingyou'regoodbyefeelingheart'swouldn'tthinkingstrangersunderstandcommitment's";
int l[]={0,3,12,22,20,17,7,3,2,1,1,0,1};
#define h "i^H3& i^83M i^6n4m3 i^J39 i^5t i^I#74L3"
#define v "_jT\\A)Q OvNrB o<@'5( q+UKpNd, *K=S4`^P("
#define n "$RaI3>;u cJ3z"
char*s="g/y'Y ?K=h4)1$ %Z{W;x. ?wEX[2\\D "n"  "h"  "v" G03F->;u kI-s<l'C  "h"  "h"  VH3: VH3: e ]^Hb^H f3: e ]^Hb^H f3:  "v"  "n"  "h"  "h"  "h" ";
char*w(int r,int c,int u,int o){m[c]=0;u+l[c]<=r?w(r,c+1,u+l[c],o+l[c]*c):strncpy(m,t+o+(r-u)*c,c);return m;}
void RA(){while(*s!=0){printf(*s==' '?"\n":"%s ",w(*s-35,1,0,0));s++;}}
  • Suggest u+l[c]>r?strncpy(m,t+o+(r-u)*c,c):w(r,c+1,u+l[c],o+l[c]*c) instead of u+l[c]<=r?w(r,c+1,u+l[c],o+l[c]*c):strncpy(m,t+o+(r-u)*c,c) and for(;*s;s++)printf(*s-32?"%s ":"\n",w(*s-35,1,0,0)); instead of while(*s!=0){printf(*s==' '?"\n":"%s ",w(*s-35,1,0,0));s++;}. Also you can combine string declarations to eliminate char several times. – ceilingcat Sep 21 '16 at 18:53

PHP 948 Bytes

$w=array("Never gonna ","Give","give","feeling","understand","goodbye","wanna","str_replace");$s=array("$w[0]$w[2]+up#$w[0]let+down#$w[0]run around@desert+#$w[0]make+cry#$w[0]say $w[5]#$w[0]tell a lie@hurt+","each other for so long#Your heart's been aching but#You're too shy to say it#Inside we both know what's been going on#We know the game@we're gonna play it","(Ooh, $w[2]+up)");$t="We're no strangers to love#You know the rules@so do I#A full commitment's what I'm thinking of#You wouldn't get this from any other guy#I just $w[6] tell+how I'm $w[3]#Gotta make+$w[4]*$s[0]*We've known $s[1]#And if+ask me how I'm $w[3]#Don't tell me+'re too blind to see*$s[0]*$s[0]*$s[2]#$s[2]#(Ooh)#$w[0]$w[2], $w[0]$w[2]#($w[1]+up)#(Ooh)#$w[0]$w[2], $w[0]$w[2]#($w[1]+up)*We've know $s[1]*I just $w[6] tell+how I'm $w[3]#Gotta make+$w[4]*$s[0]*$s[0]*$s[0]";echo nl2br($t=$w[7]("#","\n",$t=$w[7]("*","\n\n",$t=$w[7]("+"," you ",$t=$w[7]("@"," and ",$t)))));

C#, 816 803 741 737 703 chars

This is the entire class needed to print the lyrics to the console:

class r{static void Main(){new u(@"]^(Ooh,>-)|£^I just wanna:3%&Gotta 2u+ersta+^*|$(Ooh)!gi<, ne<r_gi<^(G-)^|*!g-!let% down!run1rou+{desert%!2cry!say>oodbye!t31 lie{hurt%^|3ell|2make% |#^We'<4n each o/r for s;long[r hear~1ch? but[.:o;shy:;s=Inside we both}wha~>o? on^We}/>ame{we._pl=|!^Ne<r_|& how I'm feel?^|_>onna |=ay it^|[^You|^
|-i<% up|% you|{1+ |}4 |4 know|~t's been|: t|;o |<ve|> g|?ing|/the|.'re|+nd|1 a");}class u{public u(string c){var a="We. n;strangers:;love[}/ rules{s;d;I^A full commitment's what I'm:hink? of[ wouldn't>et:his from1ny o/r>uy£#A+ if%1sk me&Don't:3 me%.:o;bli+:;see^**]]^$$#£**";foreach(var b in c.Split('|'))a=a.Replace(b[0]+"",b.Substring(1));System.Console.Write(a);}}}

And a more readable version:

class r
{
    static void Main()
    {
        new u(@"]^(Ooh,>-)|£^I just wanna:3%&Gotta 2u+ersta+^*|$(Ooh)!gi<, ne<r_gi<^(G-)^|*!g-!let% down!run1rou+{desert%!2cry!say>oodbye!t31 lie{hurt%^|3ell|2make% |#^We'<4n each o/r for s;long[r hear~1ch? but[.:o;shy:;s=Inside we both}wha~>o? on^We}/>ame{we._pl=|!^Ne<r_|& how I'm feel?^|_>onna |=ay it^|[^You|^
|-i<% up|% you|{1+ |}4 |4 know|~t's been|: t|;o |<ve|> g|?ing|/the|.'re|+nd|1 a");
    }

    class u
    {
        public u(string c)
        {
            var a = "We. n;strangers:;love[}/ rules{s;d;I^A full commitment's what I'm:hink? of[ wouldn't>et:his from1ny o/r>uy£#A+ if%1sk me&Don't:3 me%.:o;bli+:;see^**]]^$$#£**";

            foreach (var b in c.Split('|'))
                a = a.Replace(b[0] + "", b.Substring(1));

            System.Console.Write(a);
        }
    }
}

No more optimisation - I had to write myself a quick n dirty zip engine to get it this small!

626 Bytes, PHP (output as Pastebin link below)

<?=str_replace(str_split(LCB2Z34516789HJKPQRSTUVX),explode(M,"ever 6M
I just wanna J9Z
Gotta U9understand
BM279up2let 9down2run arouHaHdesert you2U9cry2say goodbye2Ja lie aHhurt youM
Never 6Mhow I'm feelXM
We'vePn eachRfor so longQr hearTachX butQ'reKshy to say it
Inside we bothP whaTgoX on
WePSgaVaHwe're 6play itM8, 79up)M8)
N1, n1
(Give 9up)Mever 6giveMgonna Mgive M
(OohMyou Mnd Mtell M too M knowM
YouM other M the Mt's been Mmake Mme Ming"),"We're no strangers to loveQPSrules aHso do I
A full commitment's what I'm thinkX ofQ wouldn't get this from anyRguyC
3
AHif 9ask VZ
Don't JVyou'reKbliHto see
B
B
4455
3
C
B
B");

To make this easier to verify, here's the output: http://pastebin.com/xzXsw3wQ

Here's the program that I used to write this program: http://pastebin.com/NGX1Qe0Z. It's pretty hacky, but it should be fairly clear how it works. There's a map array that's used to encode/decode, and the program above is written to program.php. It checks to make sure the output matches the lyrics file (lyrics.txt) and shows the byte count. You could probably do better than my byte count by writing a better map.

PHP:1002 Chars

Well this is my first CodeGolf, I'm sure I missed some things. It should echo out the lyrics with the line numbers.


I'll come back to this later, I'm a little sick of looking at these lyrics @.@ .

$o="Ooh";
$u="You";
$y="you";
$gi=" give";
$gu=ucfirst(trim($gi));
$n="Never gonna";
$yu=" $y up";
$g=" $gi $yu";
$l=" let $y down";
$r=" run around and desert $y";
$m=" make you cry";
$s=" say goodbye";
$t=" tell a lie and hurt $y";

$ch="
$n $g
$n $l
$n $r
$n $m
$n $s
$n $t";

$v1e1="I just wanna tell $y how I'm feeling
Gotta make $y understand";
$v1="We're no strangers to love
$u know the rules and so do I
A full commitment's what I'm $d thinkin' of
$u wouldn't get this from any other guy
$v1e1";
$v2="We've known each other for so long
$ur heart's been aching but 
$u're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it";
$v2e1="And if $y ask me how I'm feeling
Don't tell me $y're to blind to see";

$br="
($o,$d$g)
($o,$d$g)
($o)
$n$gi $n$gi
($gu$yu)
($o)
$n$gi $n$gi
($gu$yu)
";

$a="$v1
$ch

$v2
$v2e1
$ch
$ch
$br
$v2

$v1e1
$ch
$ch
$ch";

$z=preg_split('/\\r\\n|\\r|\\n/',$a);

$num=0;
foreach($z as $ly){echo $num." ".$ly."<br/>";$num++;}

PHP - 737 719 Characters

<?$m="str_replace";$c="^g% ^let# down^run around and desert#^make# cry^say goodbye^tell a lie and hurt#@";$w="@We've known each other for so long@Your heart's been aching but@You're too shy to say it@Inside we both know what's been going on@We know the game and we're gonna play it@";$o="(Ooh,g%)@";$a="(Ooh)^give, never gonna give@(G%)@";$i="@I just wanna tell# how I'm feeling@Gotta make# understand@";echo$m("@","<br />",$m("#"," you",$m("%","ive# up",$m("^","@Never gonna ","We're no strangers to love@You know the rules and so do I@A full commitment's what I'm thinking of@You wouldn't get this from any other guy$i$c$w And if# ask me how I'm feeling@Don't tell me#'re too blind to see@$c$c@$o$o$a$a$w$i$c$c$c"))));

Whee for breaking all sorts of rules!

HTML, 1875 bytes

This has to be done.

<pre>We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

We've known each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

(Ooh, give you up)
(Ooh, give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)

We've know each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it

I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

  • Do you really need the pre tag? – Beta Decay Oct 2 '16 at 9:17
  • @BetaDecay Yes, because without pre the linebreaks get ignored. – dorukayhan Oct 3 '16 at 2:41
  • 2
    this is low quality :| – Christopher Feb 14 at 3:27

///, 585 bytes

/?/ve//>/'re//=/ing //</ other //;/

We'?3//:/o //9/
(Ooh//8/t's been //7/
You//6/ t//5/ and //4/ gonna //3/ know//2/ how I'm feeling
//1/i?- up//-/ you//&/1)9)#gi?, ne?r4gi?
(G//%/
I just wanna6ell-2Gotta make- understand!//#/
Ne?r4//"/ each<for s:long7r hear8ach=but7>6o:shy6:say it
Inside we both3 wha8go=on
We36he game5we>4play it
//!/
#g1#let- down#run around5desert-#make- cry#say goodbye#tell a lie5hurt-/We> n:strangers6:lo?736he rules5s:d:I
A full commitment's what I'm6hink=of7 wouldn't get6his from any<guy%;n"And if- ask me2Don't6ell me->6o:blind6:see!!
9, g1)9, g&&1);"%!!

Try it online!

PHP, 1192 bytes:

<?=
'<pre>'.
(function ($compressed) {
preg_match_all("#(^.+?)\n(.+$)#us", $compressed, $matches, PREG_SET_ORDER);
list($schema, $compressed) = [ $matches[0][1] , $matches[0][2] ];
for ($ix = strlen($schema) - 1; $ix >= 0; $ix--) {
    $char = $schema[$ix];
    $charQuoted = preg_quote($char, '#');
    preg_match_all("#{$charQuoted}(.+?){$charQuoted}#mus", $compressed, $matches1, PREG_SET_ORDER);
    $fullQuoted = preg_quote($matches1[0][0], '#');
    $compressed = preg_replace("#{$fullQuoted}#mus", $matches1[0][1], $compressed);
    $compressed = str_replace($char, $matches1[0][1], $compressed);
}
return $compressed;
})(
'!"$%&*+-./0123456789:;<=>?@BCEFHJKLMPQRSTU
We9\'re9 n5o L5sLtrangSerSs2 t25lo<ve<4
YMouM4/ knowB/2heB rules0C aC>nd> 0s5d5I
AP fPull commitQmeQnt\'sE wEhatR I\'mR2hink:ingK: Kof4EMldn\'t6 g6et2hisPromCny= othS=6uy%
I justEanna2FellF1* 1yM*. howRPeel:
.Gotta Hmake1Hu>Ssta>!%
-
N$-e<r?6TonTna ?$g+Ji<J1up+-let1down-runCrM>0desSt*-Hcry-say6oodbye-tFC lie0hurt*!7

We\'</7n" each=Por s5lTg4r hear8t\'s been8CchKbut492oLhy2L@ay it
@InsideEe both/Eha86oKT
WeB6aQ0we9?pl@"A> if1ask Q.DT\'t2F Q*92o5bli>2LeeU!!U
3
(Ooh3,6;+);3,6&;3)-gJ, n$gJ
(G&&;7"%U'
).'</pre>';
?>

Live DEMO of arbitrary text (de-)compression

  • 2
    There's a lot of bytes to be saved by removing non-functional whitespace and shortening variable names. There's also no need for <pre> tags, as you can run PHP in the console. The trailing ?> can likewise be removed. – Dennis Dec 30 '17 at 14:25
  • That and replacing PREG_SET_ORDER with 2 brings your score down to 864. Try it online! – Dennis Dec 30 '17 at 14:31

Windows batch, 975 911 892 bytes

If I removed the four-space-code-indention, the result will look witty.


Just some replacement work here. For example, I set Never gonna to a variable, and replace the other Never gonna with the variable.

@echo off
set y= you 
set e=echo(
set n=ever gonna 
set g=Gotta make%y%understand
set o=(Ooh
set u=ive%y%up
set i=I just wanna tell%y%how I'm feeling
set c=call:
%e%We're no strangers to love
%e%You know the rules and so do I
%e%A full commitment's what I'm thinking of
%e%You wouldn't get this from any other guy
%e%%i%
%e%%g%
%e%
%c%n
%c%w
%e%And if%y%ask me%i:~21%
%e%Don't tell me you're too blind to see
%e%
%c%n
%c%n
%e%%o%, g%u%)
%e%%o%, g%u%)
%e%%o%)
%e%N%n% give, n%n%give
%e%(G%u%)
%e%%o%
%e%N%n% give, n%n%give
%e%(G%u%)
%e%
%c%w
%e%
%e%%i%
%e%%g%
%e%
%c%n
%c%n
%c%n 1
exit/b
:n
%e%N%n%G%u%
%e%N%n%let%y%down
%e%N%n%run around and desert you
%e%N%n%make%y%cry
%e%N%n%say goodbye
%e%N%n%tell a lie and hurt you
if %1.==. %e%
exit/b
:w
%e%Your heart's been aching but
%e%You're too shy to say it
%e%Inside we both know what's been going on
%e%We know the game and we're gonna play it

Befunge-93, 1760 1476 1434 1329 1326 1323 bytes

>9#*9#5*#24#p9#0*#11#-+#<+00p57*1-10p"vv#"56+6*9p56+6*8p89*4+8p >
<v"tell a lie and hurt you"*25
<vp30"<say goodbye"*25  #
 vp40"<make you cry"*25
 vp50"<run around and desert you"*25
 vp60"<let you down"*25 #
 vp70"vgive you up"*25
^>" annog reveN"       #^   #1 #<
>"^ ":::03p04p05p06p07p10g:03g`#^_v$
v5"Gotta make you understand":*25$<
>2*"gnileef m'I woh uoy llet annaw tsuj I"25*:"ti yalp an#"65+6v^ <p01*48p<
v"what's been going on"*52"We know the game and we're gon"p*53*<
>" wonk htob ew edisnI"25*"ti yas ot yhs oot er'uoY"25*"tub gnih"v
 v*52"We've know each other for so long"*52"Your heart's been ac"<#
v>25*")pu uoy eviG("25*"evig annog reven ,evig annog reveN"25*")hoO("
<^p+780"v"
>52*")pu uoy evig ,hoO("52*")pu uoy evig ,hoO("25*">"57*2-:10p1+8p^>65+6*8^
v"e how I'm feeling"*25"Don't tell me you're too blind to see":*25<^">"*52<
>"m ksa uoy fi dnA"25*"ti yalp annog er'ew dna emag eht wonk eW"52v>"v'eW"^
v"too shy to say it"*25"Inside we both know what's been going on"*<^"e kn"<
>" er'uoY"25*"tub gnihca neeb s'traeh ruoY"25*"gnol os rof rehto hcae nwo"^
v52"I just wanna tell you how I'm feeling"*52"Gotta make you understand":*52<
>*"yug rehto yna morf siht teg t'ndluow uoY"25*"fo gnikniht m'I tahw s'tnemtim"v
v"We're no strangers to love"*52"You know the rules and so do I"*52"A full com"<
>:#,_@

Try it online!

Golfed 284 bytes by removing Whitespace that I used in my previous attempt

Golfed 42 bytes by moving a few pointers around.

Golfed 105 bytes by using the p Instruction more often.

Golfed 3 bytes by moving p01*48p< 3 lines up.

Golfed 3 bytes by using the full length on the last 2 lines

iX2Web, 2778 bytes

Just had to make an iX2Web solution ;)

**iX200196 64378DMwlX ZSdyZSBuby BzdHJhbmdl cnMgdG8gbG 92ZbZZb3Ug a25vdyB0aG UgcnVsZXMg YW5kIHNvIG RvIEm2QSBm dWxsIGNvbW 1pdG1lbnQn cyB3aGF0IE knbSB0aGlu a2luZyBvZr ZZb3Ugd291 bGRuJ3QgZ2 V0IHRoaXMg ZnJvbSBhbn kgb3RoZXIg Z3V5tkkgan VzdCB3YW5u YSB0ZWxsIH lvdSBob3cg SSdtIGZlZW xpbme2R290 dGEgbWFrZS B5b3UgdW5k ZXJzdGFuZL a2TmV2ZXIg Z29ubmEgZ2 l2ZSB5b3Ug dXC2TmV2ZX IgZ29ubmEg bGV0IHlvdS Bkb3dutk5l dmVyIGdvbm 5hIHJ1biBh cm91bmQgYW 5kIGRlc2Vy dCB5b3W2Tm V2ZXIgZ29u bmEgbWFrZS B5b3UgY3J5 tk5ldmVyIG dvbm5hIHNh eSBnb29kYn lltk5ldmVy IGdvbm5hIH RlbGwgYSBs aWUgYW5kIG h1cnQgeW91 trZXZSd2ZS Brbm93biBl YWNoIG90aG VyIGZvciBz byBsb25ntl lvdXIgaGVh cnQncyBiZW VuIGFjaGlu ZyBidXS2WW 91J3JlIHRv byBzaHkgdG 8gc2F5IGl0 tkluc2lkZS B3ZSBib3Ro IGtub3cgd2 hhdCdzIGJl ZW4gZ29pbm cgb262V2Ug a25vdyB0aG UgZ2FtZSBh bmQgd2Uncm UgZ29ubmEg cGxheSBpdL ZBbmQgaWYg eW91IGFzay BtZSBob3cg SSdtIGZlZW xpbme2RG9u J3QgdGVsbC BtZSB5b3Un cmUgdG9vIG JsaW5kIHRv IHNlZba2Tm V2ZXIgZ29u bmEgZ2l2ZS B5b3UgdXC2 TmV2ZXIgZ2 9ubmEgbGV0 IHlvdSBkb3 dutk5ldmVy IGdvbm5hIH J1biBhcm91 bmQgYW5kIG Rlc2VydCB5 b3W2TmV2ZX IgZ29ubmEg bWFrZSB5b3 UgY3J5tk5l dmVyIGdvbm 5hIHNheSBn b29kYnlltk 5ldmVyIGdv bm5hIHRlbG wgYSBsaWUg YW5kIGh1cn QgeW91trZO ZXZlciBnb2 5uYSBnaXZl IHlvdSB1cL ZOZXZlciBn b25uYSBsZX QgeW91IGRv d262TmV2ZX IgZ29ubmEg cnVuIGFyb3 VuZCBhbmQg ZGVzZXJ0IH lvdbZOZXZl ciBnb25uYS BtYWtlIHlv dSBjcnm2Tm V2ZXIgZ29u bmEgc2F5IG dvb2RieWW2 TmV2ZXIgZ2 9ubmEgdGVs bCBhIGxpZS BhbmQgaHVy dCB5b3W2ti hPb2gsIGdp dmUgeW91IH VwKbYoT29o LCBnaXZlIH lvdSB1cCm2 KE9vaCm2Tm V2ZXIgZ29u bmEgZ2l2ZS wgbmV2ZXIg Z29ubmEgZ2 l2ZbYoR2l2 ZSB5b3UgdX AptihPb2gp tk5ldmVyIG dvbm5hIGdp dmUsIG5ldm VyIGdvbm5h IGdpdmW2KE dpdmUgeW91 IHVwKba2V2 UndmUga25v dyBlYWNoIG 90aGVyIGZv ciBzbyBsb2 5ntllvdXIg aGVhcnQncy BiZWVuIGFj aGluZyBidX S2WW91J3Jl IHRvbyBzaH kgdG8gc2F5 IGl0tkluc2 lkZSB3ZSBi b3RoIGtub3 cgd2hhdCdz IGJlZW4gZ2 9pbmcgb262 V2Uga25vdy B0aGUgZ2Ft ZSBhbmQgd2 UncmUgZ29u bmEgcGxheS BpdLa2SSBq dXN0IHdhbm 5hIHRlbGwg eW91IGhvdy BJJ20gZmVl bGluZ7ZHb3 R0YSBtYWtl IHlvdSB1bm RlcnN0YW5k trZOZXZlci Bnb25uYSBn aXZlIHlvdS B1cLZOZXZl ciBnb25uYS BsZXQgeW91 IGRvd262Tm V2ZXIgZ29u bmEgcnVuIG Fyb3VuZCBh bmQgZGVzZX J0IHlvdbZO ZXZlciBnb2 5uYSBtYWtl IHlvdSBjcn m2TmV2ZXIg Z29ubmEgc2 F5IGdvb2Ri eWW2TmV2ZX IgZ29ubmEg dGVsbCBhIG xpZSBhbmQg aHVydCB5b3 W2tk5ldmVy IGdvbm5hIG dpdmUgeW91 IHVwtk5ldm VyIGdvbm5h IGxldCB5b3 UgZG93brZO ZXZlciBnb2 5uYSBydW4g YXJvdW5kIG FuZCBkZXNl cnQgeW91tk 5ldmVyIGdv bm5hIG1ha2 UgeW91IGNy ebZOZXZlci Bnb25uYSBz YXkgZ29vZG J5ZbZOZXZl ciBnb25uYS B0ZWxsIGEg bGllIGFuZC BodXJ0IHlv dba2TmV2ZX IgZ29ubmEg Z2l2ZSB5b3 UgdXC2TmV2 ZXIgZ29ubm EgbGV0IHlv dSBkb3dutk 5ldmVyIGdv bm5hIHJ1bi Bhcm91bmQg YW5kIGRlc2 VydCB5b3W2 TmV2ZXIgZ2 9ubmEgbWFr ZSB5b3UgY3 J5tk5ldmVy IGdvbm5hIH NheSBnb29k Ynlltk5ldm VyIGdvbm5h IHRlbGwgYS BsaWUgYW5k IGh1cnQgeW 91fF8wCTAN Cg===*

Swift, 697 bytes

import Foundation
var s="We'r!n$str+gers*$love2 6*h!rules 4s$d$I\nA full commitmen8wha&I'm*hink3 of2 wouldn'&get*his from +y70uyJ%\n\nFnH\nAnd if .ask m!<Don't5m!1=blind*$see%%\n\n@@EE\nFH\nJ%%%"
for(a,b)in zip("JHFECB@?%=<:987654#>-0/.13&2+!*$","\nI jus&w+na5.<Gotta mak-nd/st+d; each7/ for s$long2r hear: ach3 but2=shy*$9it\nInsid!w!both 6 wha: go3 on\nW!6*h!gam!4we'r!goBplay it;We'v!6;?)#C, nev0oBC\n(Giv-p)\n;give;nna ;?, giv-p)\n;(Ooh;\n#giv-p#le&.down#run around 4des/&1#mak!.cry#9goodbye>5a li!4hur&1;'re*o$;how I'm feel3\n;8been;say ;t's ; oth;know;*ell ;+d ;> ;\nNev0onna;!.u;/ g;er;1 ;you;ing;t ;\nYou;an;e ; t;o ;".split{$0==";"}){s=s.replacingOccurrences(of:"\(a)",with:b)}
print(s)

Try it online!

Explanation

import Foundation                               // Import `replacingOccurrences`
var s = "<...>"                                 // The compressed text
for(a,b)in zip("<...>","<...>".split{$0==";"}){ // For every character in the first string,
  s=s.replacingOccurrences(of:"\(a)",with:b)    // replace all occurences of it with its
}                                               // replacement in the second string
print(s)                                        // Print the resulting text

Batch, 930 920 bytes

(Alternate method)

Thanks @Aacini for the skip such number of lines and show the rest of this file

@!! 2>nul||cmd/q/v/c%0&&exit/b
set l=^


set u= you 
set n=ever gonna 
set g=ive you up
set f= how I'm feeling
set w=I just wanna tell you
set c=N!n!g!g!!l!N!n!let!u!down!l!N!n!run around and desert you!l!N!n!make!u!cry!l!N!n!say goodbye!l!N!n!tell a lie and hurt you!l!
set u=Gotta make you understand!l!.!l!!c!
set k=We've know each other for so long!l!Your heart's been aching but!l!You're too shy to say it!l!Inside we both know what's been going on!l!We know the game and we're gonna play it
for /F "useback skip=15 delims=" %%a in ("%~0")do set v=%%a&echo(!v:.=!
exit/b
<
We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
!w!!f!
!u!
!k!
.
And if you ask me!f!
Don't tell me you're too blind to see
.
!c!
!c!
(Ooh, g!g!)
(Ooh, g!g!)
(Ooh)
N!n!give, n!n!give
(G!g!)
(Ooh)
N!n!give, n!n!give
(G!g!)
.
!k!
.
!w!!f!
!u!
!c!
.
!c!

Dart, 733 bytes

F(){var e=' give',a='ever gonna',l=" how I'm feeling",h=' you',i='(Give$h up)\n',j=' tell',k='(Ooh)\nN$a$e, n$a$e\n$i',b="""
N$a$e$h up
N$a let$h down
N$a run around and desert$h
N$a make$h cry
N$a say goodbye
N$a$j a lie and hurt$h

""",c="""
We've known each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it""",d="(Ooh,$e$h up)",f='I just wanna$j$h$l\nGotta make$h understand\n';return"""We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
$f
$b$c
And if$h ask me$l
Don't$j me$h're too blind to see

$b$b$d$d$k$k
$c

$f
$b$b$b""".trim();}

Try it online!

for(_="on=er< g;ve:;=na 9e:r98 I'm7ou6o 55s4me3 t22h1\n00(Ooh/ell. w- y6make ay it0 oth<  know00We':ing're at's been i: up/,;)0Y6nd  how7 feel00N8/)gi:, n8gi:0(G)0glet downrunr6ades<tcrysay;oodbyet. liehurt0I just-anna2.Gotta und<stand eachfor s5l=gr hearach but2o4hy24Inside-e both-hago =0We1e;a3we9plWe n4trang<s25lo:1e ruless5d5I0A full commit3nt's-hat71ink of-6ldn't;et1is fromnyguynAifsk 3D='t2. 32o5blit4ee0";G=/[--=-]/.exec(_);)with(_.split(G))_=join(shift())
  • 2
    Welcome to PPCG! Which programming language is this? – Dennis Nov 24 at 14:18
  • It's JavaScript – da0 Nov 25 at 1:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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