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

Answer 73 - ///

/<vsh  o[.]c;cat;#&&alert"  "
(princ//Hello World!/);%!#bye";dnl</vsh>~

Distance 7 from answer 72.

Answer 16 - Julia

println("Hello World!")

Distance from 15 = 2

  • 1
    Which answer 15 have you used? – Beta Decay Oct 27 '14 at 9:21
  • 1
    @BetaDecay I had linked to it, but I've changed it now that the C one was deleted. – Martin Ender Oct 27 '14 at 9:22

Answer 18 - JavaScript

alert("Hello World!");

Lev. Dist from A#17 = 5

  • awww, so close! you beat me by 15 secs :( – user4768 Oct 27 '14 at 9:31
  • @Stacey maybe.... – MAKZ Oct 27 '14 at 9:32
  • An alert window isn't stdout...? – zamnuts Oct 27 '14 at 18:59
  • 2
    @zamnuts It is commonly accepted on PPCG to use alert in Javascript as it has no real stdout. – Ingo Bürk Oct 27 '14 at 19:01
  • 3
    @zamnuts console.log has nothing to do with stdout. It's a debug tool. Again, this is commonly accepted here. We shouldn't litter the comments of this answer with this discussion; feel free to start a discussion on meta about it (if it doesn't exist yet). – Ingo Bürk Oct 27 '14 at 19:05

Answer 25 - Stata

display "Hello World!"

Distance: 6 ([-> ", ]-> ", and addition of di and pl)

Answer 60 - SGML

Heck, if HTML counts…

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

Distance from Answer 59 : 7

Answer 24 - M30W

say [Hello World!]

Distance: 5

  • 1
    the W must be capitalized to print "Hello World!". – user32377 Oct 27 '14 at 10:18
  • Typo, thanks for pointing it out. – Scimonster Oct 27 '14 at 10:21
  • 1
    Well, now I know why I've never heard of M30W. +1 – Pharap Oct 28 '14 at 8:33

Answer 27 - ActionScript 2

trace("Hello World!")

Distance: 7 (Disp -> trac = 4, +e( = 2, +) = 1 = 4+2+1 = 7)

From Answer 26

  • Why 2? This is ActionScript 1. – Pierre Arlaud Oct 28 '14 at 8:58
  • I used to program in AS2. I did so in flash, on the timeline. There I can have a single line of code. Then I moved to AS3, and I've been using document classes ever since. I wasn't sure whether one can use a single line of code like this in ActionScript 3, so I labelled it AS2. – user32377 Oct 28 '14 at 9:02

Answer 36 - Clojure

;ah="*#[.>]trac":;cat<<@
(pr"Hello World!"
)

Distance 7 from answer 35

; makes the rest of the line a comment, and (pr "Hello World!") does the printing

  • Love the use of the commenting – sydan Feb 13 '15 at 11:51

Answer 121 - Boo

#{//-##[][/]#i--#main(){println(
#//sel/.*}}
print("Hello World!") 
#;//"-##[;]#bye</>%"

Happy Halloween!

Distance 7 from Answer 120. Nothing fancy: added three # comment characters, and added rint after p.

Boo has syntax inspired by Python, but is a separate language with unique features built on the .NET CLI.

  • 1
    What happened to answer 120? – Hosch250 Oct 31 '14 at 17:19
  • @hosch250 seemed to just be a typo, it was relative to 120 and linked, just mislabeled. Edited – Dr. Rebmu Oct 31 '14 at 17:21
  • OK, I thought that might be the problem. – Hosch250 Oct 31 '14 at 17:25
  • 1
    I meant to complete it like Boo Yeah! – Optimizer Oct 31 '14 at 17:43
  • 2
    Appropriate language given today's date. – Amory Oct 31 '14 at 21:47

Answer 9- Ruby

puts "\x48ello World!"

Distance: 4

Answer 13 - R

#[puts];
cat("Hello World!")

Distance = 5

Answer 20 - HyperTalk

answer "Hello World!"

Distance: 7

Answer 31 - Visual FoxPro

*#]trac
? "Hello World!"

Distance: 3 from Answer 30

Not tested of course, but * begins a comment and ? "String" prints String.

  • How on earth have you ever come across and vFox? Well done/sorry :-)! – Ben Oct 27 '14 at 22:20
  • 2
    @Ben By browsing the list of "hello world" examples on Wikipedia and looking for short ones ;) – Doorknob Oct 27 '14 at 23:55

Answer 70 - Emacs Lisp

;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in
(print "Hello World!") ;%!#bye";dnl</vsh>~

Distance of 7 from Answer 69. Didn't need any changes to compile, but cleans up a bit.

  • 2
    I would've cleaned up some of the odd things like 'dnl<vsh' instead of the common comment characters. – agweber Oct 28 '14 at 15:12
  • @agweber why make things too easy? :P – resueman Oct 28 '14 at 15:16
  • 1
    @resueman Because in the question it was stated that the goal was to make the chain as long as possible. – 11684 Oct 31 '14 at 21:17

Answer 107 - MediaWiki markup

{|--#[][.]#i--#main()   {puts(,
Hello World!
|--#[;]#bye;dnl</>"%

There is already HTML, SGML and Markdown. Why not MediaWiki?

You can see it here.

Distance 7 from Answer 106.

  • 1
    Note: The spaces after main() is a tab (introduced for Makefile). I didn't change it. – jimmy23013 Oct 30 '14 at 6:47
  • Someone should get rid of it ... – Optimizer Oct 30 '14 at 9:49

Answer 32 - VBA

a="*#]trac":? "Hello World!"

Distance: 7 from Answer 31

Runs from the immediate window. The colon : is a line sepator that allows multiple lines of code to be written on the same line. (Anything run from the immediate window has to be a one liner.) The ? is a shortcut for printing to the immediate window.

  • I count more than 5: a = " is already 5, and then there is ": and the newline transformed into a space. – plannapus Oct 27 '14 at 12:22
  • You might want to dump the spaces, because right now it's 8. – Scimonster Oct 27 '14 at 12:26
  • Shoot. I forgot to remove the extra space and there is already another answer @Scimonster. – RubberDuck Oct 27 '14 at 12:27
  • I left a comment on the other answer notifying them so they can fix it after you do. – Scimonster Oct 27 '14 at 12:28
  • 3
    I like how you introduced a variable. More "programmatic" solution than just commenting some things out. – agtoever Oct 28 '14 at 11:02

Answer 167 - CDuce

(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#*)

Distance 7 from Answer 166, removed _string

Nothing special, most difficult part was finding the language.

(* *) makes a multiline comment, print prints the string

Answer 17 - Scilab

disp("Hello World!")

Distance = 6 to Answer 16

Answer 50 - Racket

;@echo o#[.>]tac";cat<<;#&&alert 
(print "Hello World!");\

Distance is 7 from the previous answer. Needs to be run in the shell.

Answer 88 - Postscript

%#[]([.]c;main()
    /eco (Hello World!)=
%#[;]:;#bye;dnl</>

Distance: 6 insertions to answer 87.

Back to real programming languages.

Answer 120 - Rebmu

{//-##[][/]#i--#main(){println(
//sel/.*}}
p("Hello World!") 
;//"-##[;]#bye</>%"

Distance 7 from Answer 119

  • { and } are asymmetric string delimiters for an alternate representation of strings permitting balanced nested pairs, embedded quotes, etc. {Hey {it's} "legal"}. Add one at the beginning then two braces to create a balanced string after the .* cost 3

  • Standalone string literals not passed to any function are skipped by the evaluator, so that literal has no effect.

  • At the outset of the program, P is a single character abbreviation for PR, itself an abbreviation for PRINT. (If you wanted you could overwrite it and use as a variable in code golf and still access printing through PR, and if you overwrite that you could use PRINT. Or set X to point to the function value of P before you override it, etc.) cost 1

  • Parentheses are structural elements that can be used for arbitrary purposes (imagine if Lisp had [] and () as different "flavors" of series you could metaprogram with, with [] having the traditional "list" behavior). In the default evaluator parens just do precedence, so there's no significance to putting it around a string literal. Added a paren instead of subtracting in case it would be helpful, either way it's cost 1

  • Semicolon comments to end of line, get rid of last line using that with an insertion so that the comment comes after it. (Would have been 1 cheaper to do that with the first 2 lines but this is perhaps a better setup.) cost 1

  • Spend extra random character to join println onto main(){ cost 1

Answer 168 Underload

(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
pint)(Hello World!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

Distance 7 from Answer 167

Answer 34 - Zsh

ah="*#[.>]trac":;<<@
Hello World!
@

Distance: 7 from Answer 33.

Since I can't craft the solution I wanted to go with from the previous one, here's another solution instead:

Answer 40 - Clipper

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

NB: There is a trailing space at the end of line 2.
Distance: 6

Clipper is unique in that it has four different commenting techniques of which I've used two above:

* A comment
// A comment
&& A comment
/* A multiline
comment */

? is obviously the print command.

Answer 48 - Lisp

;@echo o#[.>]trac";cat<<
;#&&alert 
(princ "Hello World!");\

Distance = 7

Answer 54 - Mouse

~//echo o[.>]c;cat<<;#&&alert (printf
"Hello World!"$

Distance 7 from Answer 53.

Answer 61 - M4

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

Distance from Answer 60 : 7

Answer 62 - MUMPS

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

Distance: 6

Answer 63 - TeX

%;dnl<vsh  o[.]c;cat;#&&alert" ">w "
Hello World!\bye";dnl</vsh>

Distance 7 from answer 62.

  • I'm not quite convinced whether this is valid, as the OP said you can use another output format if the language doesn't have stdout. Technically, there's \typeout in TeX (no pun intended). – nyuszika7h Oct 29 '14 at 13:19
  • Anyway, it's probably too late now, not worth breaking the chain. – nyuszika7h Oct 29 '14 at 13:24
  • @nyuszika7h: At least my version of TeX (3.1415926 (TeX Live 2014/dev)) doesn't seem to have \typeout. It works in LaTeX, which came with the same package. – Dennis Oct 29 '14 at 13:31
  • It might be LaTeX-specific then, I didn't know. – nyuszika7h Oct 29 '14 at 13:33

Answer 67 - bc

#%# %;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in( 
print "Hello World!" #%!#bye";dnl</vsh>

Distance: 7 from answer 66.

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.