[Question]
  [
In a language of your choice, write a program that *exactly* outputs the characters `Hello world!` followed by a newline. The code:
* should not use any character more than twice (alphanumeric, symbol, whitespace...anything)
* should not use any external resources
* should not use any user input
* should not output anything else
An example of a valid python program:
```
print("He%so world!"%(2*'l'))
```
An example of an invalid python program (the character 'r' is used three times):
```
print("Hel"+chr(108)+'o world!')
```
Winner is whoever has the most votes after 14 days.
EDIT: A winner has been chosen! Thanks all for your work on this question!
  
[Answer]
# 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:
* While the orignal characters appear elsewhere (unlike the ruby example), the printed string contains only non-ascii characters.
* Two from the three spaces are actually tabs, so there are no utf-8 characters that appear more than 2 times
* As binary some of the octets do appear more than 2 times, hopefully that's not against the rules. I'm trying to resolve them though.
Code:
```
echo 'ùìóùêûùëôùíçùì∏‚Ääùì¶ùóàùñóùñëùò•¬°'|iconv -t  asCIi//TRANSLIT
```
For those who don't have a proper font installed it looks like this:
![code as image](https://i.stack.imgur.com/Mnk27.png)
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](https://i.stack.imgur.com/2yfGI.png)
# 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}}
```
[Answer]
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)
[Answer]
## HQ9+, 1 char
```
H
```
keeping it simple :)
[Answer]
# Vim command (18 keystrokes)
`iHe``Esc``3al``Esc``io Wor``Right``d!``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)
`iHe``Esc``3al``Esc``io Wor``Ctrl+[``$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.
[Answer]
## 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.)
[Answer]
# Piet-- No characters whatsoever!
![Hello world in Piet](https://i.stack.imgur.com/Q5kOi.png)
[Answer]
**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!"
```
[Answer]
## Powershell, 20
```
"He$('l'*2)o world!"
```
[Answer]
# [Sclipting](http://esolangs.org/wiki/Sclipting), 11 characters
```
‰∏üÎÇÜÎÖ¨ÎãÜÎ¨¨Í∏ÖÎçØÎå¶Î°§Í∏êÎ§ä
```
I saw this beautiful HelloWorld program on [esolang's Hello World program list](http://esolangs.org/wiki/Hello_world_program_in_esoteric_languages#Sclipting).
[Answer]
# 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)
```
[Answer]
## Python 3 [38 bytes]
```
exec('import '+chr(95)*2+"h\x65llo__")
```
I wouldn't consider `import __hello__` as an external resource.
[Answer]
# 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.)
[Answer]
# 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
[Answer]
# [HTML Fiddle](http://jsfiddle.net/briguy37/q45Ee/) - 21 characters
```
Hel&#108;o World!<br>
```
[Answer]
# 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ƒá](https://codegolf.stackexchange.com/users/1308/danko-durbic)'s Powershell [answer](https://codegolf.stackexchange.com/a/18725/4198).)
```
puts"He#{?l*2}o world!"
```
[Answer]
# 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
```
[Answer]
## JavaScript, 66 characters
```
alert('Hel'+window.atob("\x62G8gd29ybGQhCg=="));//rH+in.\x689yQhC;
```
Inspired by FireFly, every character used by this code is used exactly twice.
[Answer]
## JavaScript [37 bytes]
```
alert(atob("SGVsbG8g")+'wor\x6cd!\n')
```
Too primitive isn't it?
[Answer]
# 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!
%
```
[Answer]
# 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!).
[Answer]
# 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.
[Answer]
## Malbolge
```
(=<`#9]~6ZY32Vw/.R,+Op(L,+k#Gh&}Cdz@aw=;zyKw%ut4Uqp0/mlejihtfrHcbaC2^W\>Z,XW)UTSL53\HGFjW
```
[Answer]
Actually I don't like cheating :P
**Python**
```
print("!dlrow os%eH"[::-1]%('l'*2))
```
[Answer]
## 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.
[Answer]
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!");}
```
[Answer]
### BASH
```
printf 'Hel\x6co world!\n'
```
Cred [@manatwork](https://codegolf.stackexchange.com/users/4198/manatwork)
```
echo $'Hel\x6c\x6f world!'
```
[Answer]
# C - 46 Characters
`main(){printf("He%clo wor%cd!\x0d",'l',108);}`
Prints out:
```
Hello world!
```
[Answer]
# 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 `!`.
[Answer]
# XQuery, 19 chars
```
"Hello Wor&#x6C;d!"
```
[Answer]
## 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.
]