g | x | w | all
Bytes Lang Time Link
020UiuaSBCS240811T194715ZEurope20
027JavaScript240811T043953ZAndrew B
013Keg190810T182411Zuser8505
nan181231T225351Z12Me21
033TIBASIC181230T190851ZHello Go
021Tcl181229T104808Zsergiol
019XQuery140117T181651ZMichael
nan140118T041028Zzw324
035JavaScript140119T225350ZEliseo D
nan140408T123403ZTimtech
nan140120T002820ZTomas
nan140131T133248ZGaffi
019Javascript140119T231906Z1j01
018Plain TeX140119T194315Zyo'
nan140121T183809ZToothbru
052JavaScript140129T132345ZToothbru
nan140121T103304ZBarry St
nan140117T160647ZWasi
nan140123T104738ZUdi
nan140117T171901ZJoe Z.
nan140122T001410Zqwerty
041C140121T072738ZKARTHIK
nan140119T170133ZUdi
nan140119T205959ZTomas
025k/q140120T092935ZAaron Da
011Sclipting140117T222753ZJustin
nan140120T110546ZIndoor
026POSIX shell Bash et al140120T004354ZLaurence
nan140117T204055Zcnst
nan140118T091435ZMohammad
022Lua140119T191840Zisidor3
nan140119T162620Zcormulli
192C140117T211954ZFireFly
nan140118T211513Zugoren
032C140119T020125Zmcleod_i
037JavaScript [37 bytes]140117T161556ZVisioN
nan140118T232738Zshoghicp
016HTML 16 Chars140118T190847ZDozer789
054Node.js 54 Unicode characters140118T170831Zaaaaaaaa
028Perl140118T162518ZTomas
016q/kdb [16 chars]140118T162201Znyi
029Perl140118T141552Ztobyink
027Haskell140118T125447Zvek
nan140118T010333ZFrancisc
nan140118T063408ZSSpoke
098Befunge140118T050159ZJustin
035Clojure140118T030714ZBob Jarv
066JavaScript140118T024250ZDavid Ca
033PHP140117T175344ZVereos
nan140117T223649ZDaniel A
nan140117T221923ZTimtech
nan140117T214640ZTimtech
nan140117T172804ZSztupY
017HTML —140117T212007Zcnst
nanPiet No characters whatsoever!140117T203420ZApproach
043C 43 Characters140117T192804ZKirk Bac
030PHP140117T193737ZAycan Ya
022LINQPad140117T193726ZRoss Pre
029Scala140117T175752ZKChaloux
046C 46 Characters140117T191244ZPhillip
nan140117T184116ZRunium
034Perl140117T155118Zmanatwor
021HTML Fiddle140117T182943ZBriguy37
027Ruby140117T160353Zmanatwor
nan140117T180124Zcnst
034AWK140117T162428ZWasi
nan140117T165037ZOberon
003Python 3 [38 bytes]140117T160420ZVisioN
021GolfScript140117T162906ZProgramF
nan140117T162245ZPeter Ta
020Powershell140117T155350ZDanko Du
001HQ9+140117T154705Z6160

UiuaSBCS, 20 bytes

&p-⇡12$ Hfnos%}vzun,

Subtracts the numbers 0 to 11 from the string Hfnos%}vzun,, resulting with Hello, world!, then prints it.

Bonus: every character appears only once, 22 bytes

&p-↧9⇡12$ Hfnos%}vzum*

Uses the ↧ minimum function to change the last two characters of the encoded string so that n doesn't appear twice.

Try both here!

JavaScript, 27 bytes

alert("Hel\x6Co wor\154d!")

Keg, 13 bytes

The winner was chosen, but I still want to do it. :) (Astonishingly it is shorter than HTML!)

Hel:o world\!

This is a popularity contest, but the program is very easy to understand despite of the conciseness.

Explanation

Hel          #Push "Hel" onto the stack
   :         #Duplicate the top of the stack (l)
    o world  #Push "o world" onto the stack
           \!#Escape ! and push it onto the stack(since it is an instruction)

SmileBASIC

?@H[1]+@e[!0];CHR$(108);"lo world!

Another solution:

CLS?"He__o world!
LOCATE 2,0?@l[1]*2

TI-BASIC, 33 bytes on-calculator

"l→Str1:Disp "He..o World!
Str1:Output(2,3,Ans+Ans

Since TI-BASIC uses tokens instead of characters, I limited myself by token. Make sure the screen is cleared before running the program. Note that l and o are two-byte tokens, but w is a sequence variable and d, e, and r are statistics variables, which are all one-byte tokens. This program first Displays the string without the first two l's, and then uses a different command to paste in the other two. Also note that TI-BASIC has no equivalent to a newline, but when the program ends the cursor does move down to allow further input to the calculator.

Tcl, 21 bytes

puts Hello\ wor\x6cd!

Try it online!

XQuery, 19 chars

"Hello World!"

Emacs Command (15 keystrokes)

He<Ctrl-3>l<Left>o wor<End>d!<Enter>

If that vim answers is legal then this must be too :)

Joking aside, macro it can become too :)

More nonsense aside, I can probably squeeze some more, but this seems to be good enough for the time being (since it beats vim).

P.S., please ignore all my nonsense (I (rarely, but)use vim too!).

JavaScript 35

With inspiration from @VisioN

alert(atob("SGVsbG8gV29y")+'ld!\n')

Malbolge

(=<`#9]~6ZY32Vw/.R,+Op(L,+k#Gh&}Cdz@aw=;zyKw%ut4Uqp0/mlejihtfrHcbaC2^W\>Z,XW)UTSL53\HGFjW

Taking it directly from the instructions on this page:

curl -sL bit.do/gBfx|perl -E'@Q=map{m%OUtPUTS The chARAC.ERS\N*?>([^<]+)%i?$1:()}<>;say$Q[1]'

or, if you wanna be strict with the white-spaces:

PERL

`curl -sL v.gd/92XIMS`=~m%ThE\WChAracTERS.*?>\K[^<]+%i;say$&

or

`curl -sL v.gd/qmwAMh`=~m%outpUtS\WTHE\WChAracTERS.*?>([^<]+)%i;say$1

Advantage: will work for every sentence, but please don't change wording of the question :)

Rules: we can consider this question being an "internal" resource. Without this question, no one would solve it. Should it be me or the program reading it? :)

Backstage story: I almost teared out all my hair trying to debug this! :)

First solution

Second solution

The regex could be shortened, but I like the instructions to be as long as possible :-)

These rules are damn crazy :)


PERL v5.10 say feature has to be enabled, e.g. by running PERL -E option

R

Not gonna win anything, but I didn't see R yet...

'He\154\154o, World!'
'Hello, Wor\154d!'

Javascript, 19ch

> 'Hello Wor\154d!\n'

Character count:

> "'Hello Wor\154d!\n'".length -> 15 //cough, cheating

> "'Hello Wor\\154d!\\n'".length -> 19

With your choice of return, alert(), or nothing? Man, javascript has too many contexts.

Slightly more interesting: ["He",,'o World\n'].join('l')

Plain TeX - 18 chars

He^^,lo world!\bye

Remark: TeX terminates the paragraph before shipping it, so the "newline" is actually included.

Active Server Pages (Classic ASP):

Hel<%REspOnsE.wRite Chr((0<0>-.6&"!")+&H6C+h-dinptO)
%>o world!


Each character is used twice!

To run it, you'll need a web server running IIS.

Save it in the site root with a ".asp" extension, make a HTTP request to the server, and you'll see that the response text is exactly "Hello world!" and a new line:

Hello world!


Edit: You could also use this smaller code:

Hel<%= Chr((0<0>we=6&"!")+&H6C+hd)
%>o world!

Or this:

Hel<%= CHr((0<1>wedC=8&"!&")++108)
%>o world!

JavaScript (52 characters)

alert(['He\x6C\x6Co world!'][(!1,0)-0], +-1+"Hadtw")

Each character is used 2 times, and it doesn't use any comments!

Edit: I've just posted the same answer here.

PHP I am amazed at how many people give invalid answers without mentioning they are. My attempt, only reusing o" characters twice.

<?Php EchO "Hello wor\154d!";

Edit: fixed thanks to @FireFly: i understood to use each character once. This is no challenge anymore.

Actually I don't like cheating :P

Python

print("!dlrow os%eH"[::-1]%('l'*2))

BASH

printf "a\107Vs\x62G8gd29ybGQhCg=="|base64 -d

Vim command (18 keystrokes)

iHeEsc3alEscio WorRightd!Enter

Doesn't repeat any keystroke more than twice.

It kinda violates the "user input" rule since it's still the user that needs to input that sequence, but I suppose if you store it as a macro or an nnoremap beforehand it would count, since you're just running it without explicitly doing any input to make it happen.

It also requires nocompatible to be set, which may count as using external resources, so I have provided another variation below:


Vim command (21 keystrokes)

iHeEsc3alEscio WorCtrl+[$ad!Enter

This variation doesn't require nocompatible to be set, although it does work around using Esc three times by using Ctrl+[ in its place.

http://esolangs.org/wiki/Hello%2B%2B

H

1 letter is all it takes to print that

C, 41

main(){printf("He%clo world!%c",108,10);}

AWK and echo

EDIT: fix the extra o's following the note. (thanks ProgramFOX)

echo He: | awk -F: '{print $1,Q,"\157 Wor",Q}' OFS=l ORS=d\!

and thanks awk which give me the option to say "-F" instead of "IFS=" (:-)

You have to use more expressive languages.

Chinese,  6  4   3 chars

喂世!

Running google translate on this produces Hello world!

(thanks @sreservoir and @Quincunx for the update)

k/q (25 chars)

-1@.h.uh"Hello wor%6cd!";

works in either k or q

(btw, the validity can be checked elegantly with |/#:'="-1@.h.uh\"Hello wor%6cd!\";")

Sclipting, 11 characters

丟낆녬닆묬긅덯댦롤긐뤊

I saw this beautiful HelloWorld program on esolang's Hello World program list.

Яussian

Хелло мир!

A mix of transliteration and proper language :) Google translate will turn it into proper "Hello world!"

POSIX shell (Bash et al) - 26 chars

printf 'Hel\x6Co world!\n'

nginx.conf

return  200 "He&#x6clo wo&#x72ld!\n";

In action:

% curl -6 http://localhost/ | lynx -dump -stdin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    21  100    21    0     0  20958      0 --:--:-- --:--:-- --:--:-- 21000

   Hello world!

%

c-41

main(){printf("He%clo world!%c",154,10);}

Lua - 22 characters

print"Hel\108o World!"

Simple enough, example output

lua -e 'print"Hel\108o World!"'
Hello World!

newLISP

Such a cruel challenge for a Lisp-like language, where so much is possible if only you don't count parentheses... :) But a solution can be found:

 (eval-string(encrypt {`4?3%;=6^9z*9&^m=>*],c;W}{HDMZKOQX~B2OUJ1MJQX1HBF~KU2FZD}))

(81 characters)

which uses the simple encrypt function to pass a command through to the evaluator. The actual command is (println {Hello world!}). (Having "z" and "Z" and "Z" is allowed, according to the comments...:)).

C, 192 chars

#
#
/*$$@``*/ATION_[]={9.};main(BBCDDEEFFGGHJJKKLLMMPPQQRRSSUUVVWWXXYYZZabbdefgghhjjkkmpqqsstuuvvwxyyzz) {printf("He%clo \
world!%c\
",2^7&!8.&~1|~-1?4|5?0x6C:48:6<3>2>=3<++ATION_[0],'@'^79-5);}

Since this isn't golf, I decided to have some fun and try to use every character exactly twice (while putting as few as possible in a comment, because that's boring). I realise that I didn't do terribly well, since my code contains a ton of boring "dead" code too (not in the literal sense, but in the sense of placeholder characters just used in order to fullfil the requirement). Anyway, this was surprisingly hard (but fun) with the two-character limitation, so unfortunately I couldn't come up with anything more interesting. It did give me an idea for a new problem though...

(Updated per @ugoren's comment.)

C

q=7103816;
main(){printf("%slo world!%c",&q,2+8);}

Works on little-endian platforms, where 7103816 is encoded the same as Hel\0.

C (32 characters)

main(){puts("He\x6clo world!");}

JavaScript [37 bytes]

alert(atob("SGVsbG8g")+'wor\x6cd!\n')

Too primitive isn't it?

PHP 5.1.2+

<?="\x48".hasH_file(@cRC32b,__FILE__,'« Tý'|5)." wor\X6Cd!";

The code hashes itself to get the remaining characters. Repeats the characters ".\,'_

A tab messes up the formatting. Base64:

PD89Ilx4NDgiLmhhc0hfZmlsZShAY1JDMzJiLF9fRklMRV9fLCfCqwlUw70nfDUpLiIgd29yXFg2Q2QhIjs=

HTML - (16 Chars):

Hello Wor&#108d!

Proper HTML would be to put a ; after &#108 but it still compiles fine. :)

Node.js - 54 Unicode characters

eval([]+Buffer('consolť.ŬůgĨĢHťŬɬů wɯrɬd!Ģĩ',"ascii"))

console.log outputs a given string and a line shift, unfortunately that initially leaves me with way too many ls and os, so it took some work.

The code creates a buffer from a string and is told to use ascii encoding, this effectively takes all character values mod 256 and stores them in the buffer, the buffer is then added to an empty array, which cause both buffer and array to be converted to string before the addition, an empty array converts to an empty string, and the buffer is implicitly converted using UTF-8 encoding. The result is evaled to produce the desired result.

Perl, 28 chars

printf"He%so world!\n",'l'x2

Rules tested with:

perl -e '$"="\n";@a=split//,<>;print"@a";' | sort | uniq -c | sort

q/kdb [16 chars]

"hel\154o world"

Perl, 29 characters

This answer includes x-rated clogs!

say"07-8*d<#B+>!"^xRATEDkL0GZ

Perl, 23 characters

Shorter, but no porno shoes. :-( Same basic idea though...

say'0@@lo World!'^"x%,"

Perl, 20 characters

Boring...

say"Hello Wor\x6Cd!"

Haskell, 27

main=print"Hello Wor\108d!"

Twice-check:

import Data.List
main=getContents>>=print.all((<3).length).group.sort

PHP

32 Chars

Note how I am not using a character more than twice, since l != L

He<?=strtolower("LLO WOR");?>ld!

Also note that, despite of Stack Overflow deleting it in the representation, there's a line break after the !.

Java

Okay I found this on SO, it doesn't output a big H

Rare sequence of random stream of digits for 2 specific seeds.
Probably fixed out by brute forcing
One of the SO solutions also include a brute forcer to make your own sequences.

System.out.println(randomString(-229985452) + " " + randomString(-147909649) + "!");

And randomString() looks like this

public static String randomString(int i)
{
    Random ran = new Random(i);
    StringBuilder sb = new StringBuilder();
    for (int n = 0; ; n++)
    {
        int k = ran.nextInt(27);
        if (k == 0)
            break;

        sb.append((char)('`' + k));
    }

    return sb.toString();
}

Source: https://stackoverflow.com/questions/15182496/why-does-this-code-print-hello-world

Befunge 98

a"!dlrow ol":'e'Hck,@

Here is a version where every character appears twice.

bka!e:dw"H@!dlrow  ol":'e'Hbk,a,@

Leaves a bunch of junk on the stack.

As a bonus, every single character has something done with it by the IP.

Clojure (35)

(printf "He%c%co world!\n",108,108)

The whitespace almost got me, but Clojure allows the use of commas to separate parameters.

JavaScript, 66 characters

alert('Hel'+window.atob("\x62G8gd29ybGQhCg=="));//rH+in.\x689yQhC;

Inspired by FireFly, every character used by this code is used exactly twice.

PHP, 33 chars

I just love how much PHP is forgiving and understanding!

<?=Hel.str_rot13("yb jbe").'ld!';

Before it was deleted (or if it's still there, I'm totally blind), I saw a comment saying "No brainf*ck? :D". Well, it is pretty much impossible to write a solution in BrainF*ck, as you know. But I managed to code this, just for the lulz.

++++++++++[>++++>+++++>++++++>+++++++>++++++++++>+++++++++++>+++++++++<<<<<<<-]
>>>.+++.--.>++.>+.+++++++.<<<<++++++.>>>>>+++++.+.--.>+++++.<.---.+++++.<<<<-.+
+.<------.------.>>>>>+++++.<----------.<<<<--.>>>>++++++++.--------.+++.
<<<<++.+++++++.+++++.-------.>>>>+++++++.--------.<<<<------.++++++.>++++++++.

If you don't have a BF interpreter, the code above just prints the PHP one :P

In C. Choose one of these.

My favourite (crazy but compact in memory):

#include <stdint.h>
printf("%s", (char*)(int32_t[]){1819043144,1870078063,6581362});

For those who like big numbers:

printf("%s", (char*)(int64_t[]){8031924123371070792,43509902450});

Or here the more descriptive versions:

printf("%s", (char*)(int32_t[]){0x6c6c6548,0x6f77206f,0x646c72});
printf("%s", (char*)(int64_t[]){0x6f77206f6c6c6548,0x0a21646c72});

char map:

H  e  l  l     o     w  o     r  l  d  !     <LF>
48 65 6c 6c    6f 20 77 6f    72 6c 64 21    0a
(remember to swap big/little endian bytes when composing)

Btw: why there is no 128 bit integer in C?

printf("%s", (char*)(int128_t[]){0x0a21646c726f77206f6c6c6548});
printf("%s", (char*)(int128_t[]){802616035175250124568770929992}); // string uses only 100 of 128 bits

Hexish    

0B

Fugue

From the esolang wiki:

enter image description here

And you can listen to the source code.

Ruby (1.9+)

Since this is a popularity contest let's try to not use ANY of the characters from 'Hello world!' while still using other characters only a maximum of two times:

puts("S\107VsbG8gV29ybGQhCg".unpack(?m))

It's 40 chars btw.

Bash

And this one uses unicode magic.

Notes:

Code:

echo '𝓗𝐞𝑙𝒍𝓸 𝓦𝗈𝖗𝖑𝘥¡'|iconv -t  asCIi//TRANSLIT

For those who don't have a proper font installed it looks like this:

code as image

Here is the hexdump:

00000000  65 63 68 6f 20 27 f0 9d  93 97 f0 9d 90 9e f0 9d  |echo '..........|
00000010  91 99 f0 9d 92 8d f0 9d  93 b8 e2 80 8a f0 9d 93  |................|
00000020  a6 f0 9d 97 88 f0 9d 96  97 f0 9d 96 91 f0 9d 98  |................|
00000030  a5 c2 a1 27 7c 69 63 6f  6e 76 09 2d 74 09 61 73  |...'|iconv.-t.as|
00000040  43 49 69 2f 2f 54 52 41  4e 53 4c 49 54 0a        |CIi//TRANSLIT.|
0000004e

You have to run it on a machine where the default charset is utf-8. I tried on an OSX10.8 using iTerm2 with the following environment:

bash running in iTerm2

PHP 5.4

This uses zLib: (unfortunately it does uses the characters e and o)

<?=gzuncompress('x▒▒H▒▒▒W(▒/▒IQ▒!qh');

Hexdump:

00000000  3c 3f 3d 67 7a 75 6e 63  6f 6d 70 72 65 73 73 28  |<?=gzuncompress(|
00000010  27 78 9c f3 48 cd c9 c9  57 28 cf 2f ca 49 51 e4  |'x..H...W(./.IQ.|
00000020  02 00 21 71 04 68 27 29  3b                       |..!q.h');|
00000029

+1

Here is the ruby 2.0 code I used to test for duplicates:

d=ARGF.read
p [d.split(//),d.unpack('C*')].map{|x|x.inject(Hash.new(0)){|i,s|i[s]+=1;i}.select{|k,v|v>2}}

HTML — 17 characters

He&#x6c;lo world!

In action:

%echo -n "He&#x6c;lo world!" | wc
       0       2      17
%echo -n "He&#x6c;lo world!" | lynx -dump -stdin

   Hello world!

%

Piet-- No characters whatsoever!

Hello world in Piet

C - 43 Characters

main(){printf("Hel%co World!%c",'k'+1,10);}

Output

Hello World!

Character Counts

' ' Count: 1    '!' Count: 1    '"' Count: 2    '%' Count: 2    ''' Count: 2
'(' Count: 2    ')' Count: 2    '+' Count: 1    ',' Count: 2    '0' Count: 1
'1' Count: 2    ';' Count: 1    'H' Count: 1    'W' Count: 1    'a' Count: 1
'c' Count: 2    'd' Count: 1    'e' Count: 1    'f' Count: 1    'i' Count: 2
'k' Count: 1    'l' Count: 2    'm' Count: 1    'n' Count: 2    'o' Count: 2
'p' Count: 1    'r' Count: 2    't' Count: 1    '{' Count: 1    '}' Count: 1

PHP, 30 characters

Highly inspired by Vereos's answer.

<?=Hello.' wor'.chr(108),"d!";

LINQPad, C# Expression - 22 chars

"Hello w\x6fr\x006cd!"

Scala: 34 29 characters

I'm proud of myself for this one:

printf("He%c%co world!\n",108,108)

Had a really hard time overcoming duplicate 'l's, 'r's, quotation marks and brackets. Then I discovered the old Java printf function, which will happily convert numbers to letters when given the %c format specifier.

Update

MrWonderful did a wonderful thing by pointing out that a whole bunch of characters can be saved by using up my second 'l' manually in the string!

printf("Hel%co world!\n",108)

C - 46 Characters

main(){printf("He%clo wor%cd!\x0d",'l',108);}

Prints out:

Hello world!

BASH

printf 'Hel\x6co world!\n'

Cred @manatwork

echo $'Hel\x6c\x6f world!'

Perl: 34 characters

$_="He12o wor3d!
";s{\d}{l}g;print

Sample run:

bash-4.1# perl -e '$_="He12o wor3d!
> ";s{\d}{l}g;print'
Hello world!

(Not a big deal. Posted just to use at least once in my life s/// with those fancy delimiters.)

HTML Fiddle - 21 characters

Hel&#108;o World!<br>

Ruby: 27 characters

puts [:Hel,'o wor',"d!"]*?l

Sample run:

bash-4.1# ruby <<ENDOFSCRIPT
> puts [:Hel,'o wor',"d!"]*?l
> ENDOFSCRIPT
Hello world!

Ruby: 25 characters

(Based on Vache's comment.)

puts 'He'+?l*2+"o world!"

Ruby: 23 characters

(Copy of Danko Durbić's Powershell answer.)

puts"He#{?l*2}o world!"

nginx.conf

set $i l;
return 202 "Hel${i}o world!\n";

In action:

opti# curl -6v "http://localhost/"
* About to connect() to localhost port 80 (#0)
*   Trying ::1...
* connected
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 202 Accepted
< Server: nginx/1.4.1
< Date: Fri, 17 Jan 2014 18:02:08 GMT
< Content-Type: application/octet-stream
< Content-Length: 13
< Connection: keep-alive
<
Hello world!
* Connection #0 to host localhost left intact
* Closing connection #0

AWK,34

BEGIN{printf"Hel%co world!\n",108}

Hmm.

In C, given these rules, we can only have one #define (because of i and n) and at most two function calls OR definitions (( and )).

I presume there's pretty much only one way to do it (though I'm probably wrong):

main(){puts("Hello w\x6fr\154d!");}

Python 3 [38 bytes]

exec('import '+chr(95)*2+"h\x65llo__")

I wouldn't consider import __hello__ as an external resource.

GolfScript, 21 characters

'He'[108]+"lo world!"

108 is the ASCII code for l.

First, I push He on the stack. Then, He gets popped and becomes Hel. Then I push lo world! on the stack. Now there are two elements on the stack. Because at the end of a GolfScript program, everything of the stack is outputted, this program outputs:

Hello world!

followed by a newline, because Golfscript always outputs a newline.

GolfScript

'He

o world!'n/"l"*

Substitutes two newlines (fortunately the third one, needed for the substitution, is provided by the built-in n), using both types of string literal to avoid quadruplicate copies of a quote mark. Since l is the only character which occurs more than twice in the original string, it's not too hard.

Powershell, 20

"He$('l'*2)o world!"

HQ9+, 1 char

H

keeping it simple :)