This contest is officially over, the winner is jimmy23013. Congratulations!

The challenge is to make a program that prints Hello World! to stdout. The catch is that your program must have a Levenshtein distance of 7 or less from the program in the answer submitted before yours.

How This Will Work

Below I have already submitted the first answer using Python: print("Hello World!").

The next person to answer must modify the string print("Hello World!") with up to 7 single character insertions, deletions, or substitutions so that when it is run in any language that hasn't been used so far (only Python in this case) the output is still Hello World!.

For example the second answerer might use 1 substitution (r -> u), 2 deletions (in), and 1 insertion (s) to make the string puts("Hello World!") which prints Hello World! when run in Ruby.

The third person to answer must do the same thing in a new language, but using the program of the second person's answer (e.g. puts("Hello World!")) as their starting point. The fourth answer will be in relation to the third answer and so on.

This will continue on until everyone get stuck because there is no new language the last answer's program can be made to run in by only changing 7 characters. The communal goal is to see how long we can keep this up, so try not to make any obscure or unwarranted character edits (this is not a requirement however).

Formatting

Please format your post like this:

#Answer N - [language]

    [code]

[notes, explanation, observations, whatever]

Where N is the answer number (increases incrementally, N = 1, 2, 3,...).

You do not have to tell which exact characters were changed. Just make sure the Levenshtein distance is from 0 to 7.

Rules

The key thing to understand about this challenge is that only one person can answer at a time and each answer depends on the one before it.

There should never be two answers with the same N. If two people happen to simultaneously answer for some N, the one who answered later (even if it's a few seconds difference) should graciously delete their answer.

Furthermore...

  • A user may only submit one answer per 8 hour period. i.e. Each of your answers must be at least 8 hours apart. (This is to prevent users from constantly watching the question and answering as much as possible.)
  • A user may not submit two answers in a row. (e.g. since I submitted answer 1 I can't do answer 2, but I could do 3.)
  • Each answer must be in a different programming language.
    • Different versions of the same language count as the same language.
    • Languages count as distinct if they are traditionally called by two different names. (There may be some ambiguities here but don't let that ruin the contest.)
  • You may only use tabs, newlines, and printable ASCII. (Newlines count as one character.)
  • The output should only be Hello World! and no other characters (a leading/trailing newline is not an issue).
  • If your language doesn't has stdout use whatever is commonly used for quickly outputting text (e.g. console.log or alert in JavaScript).

Please make sure your answer is valid. We don't want to realize there's a break in the chain five answers up. Invalid answers should be fixed quickly or deleted before there are additional answers.

Don't edit answers unless absolutely necessary.

Scoring

Once things settle down, the user who submits the most (valid) answers wins. Ties go to the user with the most cumulative up-votes.

Leaderboard: (out of date)

(user must have at least 2 valid answers)

11 Answers

7 Answers

6 Answers

5 Answers

4 Answers

3 Answers

2 Answers

Languages used so far:

  1. Python
  2. CJam
  3. PHP
  4. Pyth
  5. Perl
  6. Befunge 98
  7. Bash
  8. Nimrod
  9. Ruby
  10. GNU dc
  11. Golfscript
  12. Mathematica
  13. R
  14. Lua
  15. Sage
  16. Julia
  17. Scilab
  18. JavaScript
  19. VHDL
  20. HyperTalk
  21. Haskell
  22. LOLCODE
  23. APL
  24. M30W
  25. Stata
  26. TI-BASIC (NSpire)
  27. ActionScript 2
  28. J
  29. PowerShell
  30. K
  31. Visual FoxPro
  32. VBA
  33. Extended BF Type III
  34. Zsh
  35. Dash
  36. Clojure
  37. NetLogo
  38. Groovy
  39. CoffeeScript
  40. Clipper
  41. B.A.S.I.C.
  42. FALSE
  43. fish (shell)
  44. GNU Octave
  45. TCL
  46. E
  47. newLisp
  48. Lisp
  49. SMT-LIBv2
  50. Racket
  51. Batsh
  52. tcsh
  53. AppleScript
  54. Mouse
  55. Pixie
  56. F#
  57. Falcon
  58. Burlesque
  59. HTML
  60. SGML
  61. M4
  62. MUMPS
  63. TeX
  64. Forth
  65. Salmon
  66. Turing
  67. bc
  68. Betterave
  69. Scheme
  70. Emacs Lisp
  71. Logo
  72. AutoLISP
  73. ///
  74. Rebol
  75. Maple
  76. FreeBASIC
  77. Vimscript
  78. ksh
  79. Hack
  80. mIRC
  81. Batch
  82. Make
  83. Markdown
  84. sh
  85. GDB
  86. csh
  87. HQ9+-
  88. Postscript
  89. Matlab
  90. Oz
  91. CASIO BASIC
  92. VBScript
  93. QBasic
  94. Processing
  95. C
  96. Rust 0.13
  97. Dart
  98. Kaffeine
  99. Algoid
  100. AMPL
  101. Alore
  102. Forobj
  103. T-SQL
  104. LiveCode
  105. Euphoria
  106. SpeakEasy
  107. MediaWiki
  108. SmallBASIC
  109. REXX
  110. SQLite
  111. TPP
  112. Geom++
  113. SQL (postgres)
  114. itflabtijtslwi
  115. RegXy
  116. Opal.rb
  117. Squirrel
  118. Pawn
  119. Scala
  120. Rebmu
  121. Boo
  122. PARI/GP
  123. Red
  124. Swift
  125. BeanShell
  126. Vala
  127. Pike
  128. Suneido
  129. AWK
  130. Neko
  131. AngelScript
  132. gosu
  133. V
  134. ALAGUF
  135. BogusForth
  136. Flaming Thunder
  137. Caché ObjectScript
  138. owl
  139. Cardinal
  140. Parser
  141. Grin
  142. Kitten
  143. TwoDucks
  144. Asymptote
  145. CAT
  146. IDL
  147. Tiny
  148. WTFZOMFG
  149. Io
  150. MuPAD
  151. Java
  152. Onyx
  153. JBoss
  154. S+
  155. Hexish
  156. yash
  157. Improbable
  158. wake
  159. brat
  160. busybox built-in shell
  161. gammaplex
  162. KTurtle
  163. AGOL 68
  164. Alice
  165. SML/NJ
  166. OCaml
  167. CDuce
  168. Underload
  169. Simplex v.0.6
  170. Minkolang 0.9
  171. Fexl 7.0.3
  172. Jolf
  173. Vitsy
  174. Y
  175. Retina
  176. Codename Dragon
  177. Seriously
  178. Reng v.3.3
  179. Fuzzy Octo Guacamole

(Feel free to edit these lists if they are incorrect or out of date.)

This question works best when you sort by oldest.

NOTE: This is a trial question for a new challenge type I have in mind where each answer depends on the last and increases in difficulty. Come discuss it with us in the chatroom for this question or in meta.

180 Answers 180

up vote 28 down vote accepted
+200

Answer 85 - GDB (GNU Debugger)

#[]([.]c;main()&alert"  "
    echo Hello World!
#[;]:;#bye;dnl</vsh>

I think this can also be qualified as a programming language. It has even if and while commands.

echo is another built in command in GDB.

To run this code:

gdb --batch -x file

Distance: 7 from answer 84.

  • Please revision your answer, the 85 was an invalid answer (I didn't notice the language had been used before) and I deleted it. – Nit Oct 29 '14 at 11:09
  • Any link to GDB ? – Optimizer Oct 29 '14 at 11:10
  • 1
    @Optimizer gnu.org/software/gdb The Gnu Debugger. – jimmy23013 Oct 29 '14 at 11:11
  • Its like running java project in Eclipse rather than Netbeans – Optimizer Oct 29 '14 at 11:15
  • 3
    This answer is fine. GDB has a command language which is used to execute specific debug commands. This is done by running GDB in batch mode and specifying the command file using --batch -x <file>. This is a legit language. See here: sourceware.org/gdb/onlinedocs/gdb/Mode-Options.html (-batch flag) – user4768 Oct 29 '14 at 11:25

Answer 1 - Python

print("Hello World!")

There's got to be dozens of languages this could morph into.

  • 113
    Why is this being up-voted but not the question? I guarantee you the question was harder to write ;) – Calvin's Hobbies Oct 27 '14 at 7:13
  • 91
    Why is your comment being up-voted more than your answer? – tomsmeding Oct 27 '14 at 10:49
  • 23
    @Calvin'sHobbies Answer upvotes are worth more, you shouldn't complain :-) – Angew Oct 27 '14 at 12:20
  • 30
    @tom Why is your comment being up-voted more than this answer? – nicael Oct 30 '14 at 17:39
  • 24
    ^ All of them regretting that there are no rep awarded for comment upvotes! – Optimizer Nov 1 '14 at 21:26

Answer 59 - HTML

What? No HTML ??

<echo o[.]c;cat<<;#&&alert" ">Hello World!</vsh

Distance from Answer 58 : 6

Voodoo Magic ? Nah. Here is how it works:

You can have any arbitrary tag in HTML, so the first part <echo o[.]c;cat<<;#&&alert" "> is an echo tag, which now becomes a blank tag with no CSS applied by default by the browser.

The o[.]c;cat<<;#&&alert" " part is actually two properties set on that tag separated by space. So the first property has the key o[.]c;cat<<;#&&alert" and second key is " and both the values are blank.

Second part is just plain text Hello World! which is the text contents of the echo tag.

Next up, HTML tries to find the closing echo tag, but instead, finds a closing vsh tag. It then ignores the closing vsh tag (i.e. </vsh) and auto closes the echo tag.

  • 2
    @MAKZ HTML is pretty free and loose. You can have unmatched opening closing tags and what not. XHTML is pretty strict. w3schools is a good starting point. – Optimizer Oct 28 '14 at 7:30
  • 3
    You can have any tag in HTML, so echo is a normal tag. o[.]c;cat<<;#&&alert" is a property on that tag and the last " is another property on that tag. You can see this using Inspector developer tool too. – Optimizer Oct 28 '14 at 7:38
  • 3
    Pretty dang clever. Never would have thought of it. – RubberDuck Oct 28 '14 at 13:33
  • 14
    I think this is what happens when you read standards documents at 3 am while on peyote. – David Conrad Oct 31 '14 at 17:13
  • 5
    @Optimizer Required reading for people recommending w3schools. ;) – Martin Ender Dec 18 '14 at 15:00

Answer 95 - C

//[]([.]c;
main()    {
    puts("Hello World!");}
//#[;]#bye;dnl</>

Distance 7 from answer 94

  • 38
    Bloody finally. – Nit Oct 29 '14 at 20:18
  • @Optimizer I didn't get any kind of runtime error using gcc 4.7.2 on my computer. – archaephyrryx Oct 29 '14 at 20:21
  • 1
    @Emil Just vim auto-indentation; OP's call on what to do about this (if it progresses too far to fix, you can just pretend that it's a tab and make the distance 7) – archaephyrryx Oct 29 '14 at 20:31
  • 1
    @user23013 Because the program doesn't specify int as the return type for main and doesn't actually return an exit code; therefore, the return code is technically undefined behavior, hence the 13. – Qix Nov 5 '14 at 0:33
  • 1
    Some of the previous answers (starting from 85 GDB) did extra work to prepare for C. – kernigh Nov 21 '14 at 20:27

Answer 22 - LOLCODE

VISIBLE "Hello World!"

Distance : 6

  • Looks like distance 6 to me - delete p, ut -> VI, tr -> IB, n -> E – isaacg Oct 27 '14 at 9:58
  • 1
    Thanks. I think I copied different code while calculating distance. – Snack Oct 27 '14 at 9:59

Answer 151 - Java

//#
class jux{public static void main(String[] h){System.out.println(//;\#//Hello*}}print,
"Hello World!");}}//print"putsx;//-##[;]#bye</>%"

Distance from Answer 150 : 7

Try it here

(Thanks to Christopher Creutzig for being such a sport :) )

  • 3
    Now for the C# answer! – Rodolvertice Nov 5 '14 at 1:31

Answer 10 - GNU dc

[puts "\x48][Hello World!]p

Distance: 6

  • 7
    Well this is hard. Haha. – Mark Gabriel Oct 27 '14 at 7:51
  • @MarkGabriel Hint: Substring. – jimmy23013 Oct 27 '14 at 8:10

Answer 4 - Pyth

"Hello World!

This answer is a distance of 6 from the previous answer. Pyth strings do not need a closing quote if they are at the end of a line.

  • 3
    Darn, I had a good one for the previous. – Justin Oct 27 '14 at 6:36

Answer 11 - Golfscript

#[puts "\x48]
"Hello World!"

A distance of 5.

Answer 83 - Markdown

What ?? No Markdown ? :P

[](#[.]c;cat;#&&alert"  "
    @echo)Hello World!
[;]:;#bye;dnl</vsh>

Try it here

Distance from Answer 82 : 7

e   -> [
:   -> ]
\n  -> (
o H -> o)H
:   -> [
#   -> ]
"   -> :

Voodoo magic ?? Nah!! Here is how it works:

  • [text](link) creates a link.

So the first part of the code is

[](#[.]c;cat;#&&alert"  "
        @echo)

Which creates an empty text link with location

#[.]c;cat;#&&alert"  "
     @echo
  • Next part Hello World! is printed as is

  • Then [;]:;#bye;dnl</vsh> creates a reference link for ; which can be used anywhere in the markdown.

Ex:

[Some text][;] // Outputs a link with text "Some text" and url ";#bye;dnl</vsh>"
  • 1
    It's getting questionable whether that's a programming language. (Same for HTML actually.) – Martin Ender Oct 29 '14 at 10:01
  • 1
    Well, If HTML is a language, Markdown is too. Its the same relation between JS and Closure. Also, given this challenge (1 lang per ans), these rules ought to be loosened a bit. – Optimizer Oct 29 '14 at 10:03
  • 1
    As I said, I don't think HTML is a programming language either by our standards. But for the purpose of this particular challenge it's probably fine to loosen those rules (but ideally Calvin's Hobbies should state that). – Martin Ender Oct 29 '14 at 10:04
  • 4
    Can we have this discussion somewhere else rather than on my answer ? :) – Optimizer Oct 29 '14 at 10:52
  • 2
    Still pretty impressive – Fabinout Oct 31 '14 at 9:17

Answer 15 - Sage

print("Hello World!")

Distance = 6

Full circle.

Answer 12 - Mathematica

#[puts];
"Hello World!"

Distance of 7. Attempting to clear up some of that mess.

up vote 15 down vote
+100

Answer 2 – CJam

"Hello World!"

This is a distance of 7 from the first answer

Try it online here

Answer 19 - VHDL

report "Hello World!";

Distance: 6

  • 1
    wow :) ........ stubborn huh? – MAKZ Oct 27 '14 at 9:43
  • 2
    Haha, I've been waiting for a code golf question that allows me to use an HDL :p – user4768 Oct 27 '14 at 9:46

Answer 6 - Befunge 98

<@,kb"Hello World!"

Distance of 5 from the previous answer. There was originally a bug where the k wasn't there; I know it was there when I wrote this program, though. I guess it just didn't make it into this post.

  • I should have inflated this, but oh well. – Justin Oct 27 '14 at 6:43
  • I'm just going to post answer 7 based on the inflated version... – jimmy23013 Oct 27 '14 at 6:44
  • 6
    @Quincunx I can't imagine us ever being able to get up to System.out.println... – Sp3000 Oct 27 '14 at 6:52
  • 4
    @Sp3000 We can firstly write the Java program in a comment. Then turn everything else into a comment. – jimmy23013 Oct 27 '14 at 6:56
  • 4
    I had considered allowing multiple responses per answer so it could branch out like a tree. Then you guys could go on your little Java tangent. That would be way too confusing though... – Calvin's Hobbies Oct 27 '14 at 7:02

Answer 23 - APL

 "Hello World!"

Note there's a leading space.
Distance: 7

  • 2
    the W must be capitalized to print "Hello World!". – user32377 Oct 27 '14 at 10:18

Answer 3 – PHP

<?="Hello World!"?>

This answer is a distance 5 from the second answer.

  • Please note that the string "Hello World!" verbatim, which is obviously distance 0 from answer 2, is a valid PHP program outputting the required string, and explicit print statement is unnecessary. – hijarian Oct 28 '14 at 11:55
  • @hijarian: That's only true for the PHP shell, which makes it invalid for this challenge. – Dennis Oct 28 '14 at 21:02
  • 1
    @Dennis If you write a script helloworld.php, and put the 12 symbols Hello World! in there and then you run this script with php helloworld.php, you'll get Hello World! printed to stdout as PHP treat everything outside of <?php ?> processing instruction as raw text to output. – hijarian Oct 29 '14 at 4:30
  • I have realized that you'll need to remove quotation marks (which makes it Levenstein distance 2) to be fully compliant. – hijarian Oct 29 '14 at 4:30
  • 4
    @Petah So? This is not code golf. We are not supposed to make it as short or as easy to continue as possible. – Pietu1998 Oct 31 '14 at 8:04

Answer 28 - J

]trace=:('Hello World!')

Distance = 5 from Answer 27

  • 1
    ] + = + : + ' + ' = 5, right? – user32377 Oct 27 '14 at 10:37
  • 3
    Sure. Missed it being quick... This type of question surely adds a real time feeling to code challenges :P. – jpjacobs Oct 27 '14 at 10:40
  • one of the oddest notations for a language with such a simple name... – CoDEmanX Nov 5 '14 at 2:15
  • And J could have been answer 2, by deleting the print and replacing the double with single quotes, ending up with ('Hello World!'). – bcsb1001 Dec 21 '14 at 17:10

Answer 5 - Perl

print"Hello World!"

This answer is a distance 6 from the fourth answer.

Answer 8 - Nimrod

echo "\x48ello World!"

Distance of 6 from the last answer.

  • 1
    There's not supposed to be a comma. – feersum Oct 27 '14 at 7:04

Answer 14 - Lua

#[put
print("Hello World!")

Distance = 7

  • 8
    Aaand we're back to the start, good job. – Nit Oct 27 '14 at 9:04
  • hi @Timmy, I'm sorry but I had to change my answer from print to cat. – Mark Gabriel Oct 27 '14 at 9:04

Answer 21 - Haskell

putStrLn "Hello World!"

Distance: 7

  • 3
    Am I the only one who thinks Haskell's version of print is dafter than LOLCODE's? – Pharap Oct 28 '14 at 8:30
  • 4
    @Pharap: Haskell's version of print is called print, and it does something rather un-daft: print some value, of any¹ type – but in valid Haskell notation! So print 5 yields 5 as output, and print "Hello World!" yields "Hello World!"; but the challenge asked for Hello World, without quotation marks (which wouldn't be valid Haskell). – ceased to turn counterclockwis Oct 28 '14 at 10:43
  • 3
    @Pharap ¹It doesn't actually work with any type, only with Showable types. – ceased to turn counterclockwis Oct 28 '14 at 10:45
  • 1
    @leftaroundabout Well, suum cuique pulchrum est I suppose. – Pharap Oct 28 '14 at 10:52
  • @ceasedtoturncounterclockwis data W=World;data H=Hello W; Hello World – Esolanging Fruit Dec 8 '17 at 4:27

Answer 26 - TI-BASIC (NSpire)

Disp "Hello World!"

Distance: 5 from answer 25

(Tested on a TI-NSpire calculator)

  • 2
    I see you have an NSpire calculator; that should be noted in the title as TI-83/84/+/SE do not have lowercase letters. – Timtech Oct 27 '14 at 11:15
  • 2
    @Timtech They actually do have lowercase letters. If you have MirageOS or another custom OS, you can enable them. Here's a screenshot of a program I wrote a while ago that uses lowercase letters. – wchargin Oct 28 '14 at 19:20

Answer 33 - Extended BF Type III

a#="*#[.>]trac": "@Hello World!

Distance 7 from Answer 32

Well, I have not found an interpreter for that extension but the code seems to fit the specs of the language.

a //ignored
#="*# //comment
[.>] //print each character until an empty cell
trac" //ignored
: //move pointer, do not impact result
 " //ignored
@ //end of source
Hello World! //Injected in cells before execution
  • 1
    Just so you know, the above answer is invalid as it has a distance of 8. That should be fixable by removing some spaces though, so you might want to fix yours after the other guy does. – Scimonster Oct 27 '14 at 12:26
  • 1
    It's corrected. My apologies. – RubberDuck Oct 27 '14 at 12:29
  • 1
    My answer is also fixed. – Michael M. Oct 27 '14 at 12:30
  • 1
    I got a neat one lined up for this, can't wait for the 8-hour timer. – Nit Oct 27 '14 at 14:04

Answer 100 - AMPL

#[][.]#i
#main()    {
    print("Hello World!");
#[;]#bye;dnl</>

Distance 6 from Answer 99

  • 8
    WOOO. #100! Have +10 rep. – Kaz Wolfe Oct 29 '14 at 23:04

Answer 7 - Bash

echo Hello World!

This is a distance of 7 from the sixth answer.

  • 1
    A lame distance zero from here would be Batch.... Quick @RandomUserViewingThisComment, go post it! – Justin Oct 27 '14 at 6:59
  • @Quincunx Distance 1 with the @ character. – jimmy23013 Oct 27 '14 at 7:01
  • @user23013 Good point; I'm very poorly acquainted with Batch.... But it would work in commandline. – Justin Oct 27 '14 at 7:03
  • @Quincunx Or it will print \nX:\Your\Working\Directory>echo Hello World!\nHello World! in a script. Or I should mean \r\n for \n. – jimmy23013 Oct 27 '14 at 7:08
  • @user23013 Oh, that makes sense. – Justin Oct 27 '14 at 7:11

Answer 29 - MS Windows Powershell

#]trace=:(
'Hello World!'

Distance = 3 from Answer 28

  • 3
    Actually, I liked how the punk-haired smiley just appeared... =:( – agtoever Oct 28 '14 at 10:59
  • 2
    From this point on, the answers accumulate junk (usually commented out). Answer 85 (GDB) added a "main", and the answers eventually reached C and then Java. – kernigh Nov 21 '14 at 22:07

Answer 42 - FALSE

{#ah="*#[.>]trac";cat<<@
#&&alert 
?} "Hello World!
"

Levenshtein distance from #41 is 7. Tested with this online implementation of FALSE. I used some leftover edit-distance slots to remove some cruft...

  • I should have done some of that cruft cleaning myself, but I can't now. I'd break the chain. – TecBrat Oct 28 '14 at 15:00
  • 3
    random upvote for being answer 42 - the answer is false :P – CoDEmanX Nov 5 '14 at 2:24

Answer 150 - MuPAD

//#class jux{public static void main(String[] h){System.out.println(;\#//Hello*}}print,
"Hello World!"//print"putsx;//-##[;]#bye</>%"

Distance 6 from answer 149.

EDIT: Added “ h” to move the chain forward.

  • Ah... If you could have just put an h after the String[], next answer would have been in Java ;) – Optimizer Nov 4 '14 at 15:45
  • 2
    In the interest of getting a long chain, I guess I'll just cheat and edit that in right now. ;-) – Christopher Creutzig Nov 4 '14 at 15:47

Answer 30 - K

/#]trac
"Hello World!"

Distance: 7 from Answer 29

I think this works, an interpreter is here (Kona). / begins a one-line comment in K. I've cleaned up some of the #]trace=:( mess.

protected by Community Nov 5 '14 at 21:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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