15
\$\begingroup\$

In the spirit of Hello world! with NO repetition

Write a program that prints the string "the quick brown fox jumps over the lazy dog" with optional newline. The entire program must not repeat any characters.

Note that the string to be printed does repeat characters, so you will have to get around that limitation somehow.

Note that the winning condition is , i.e. the highest-voted answer wins.

Update: To make this a little easier, repetition is allowed but you must attempt to minimize it. Programs with less (or no) repetition are given precedence over programs with some repetition.

\$\endgroup\$
7
  • \$\begingroup\$ I'm afraid this is probably too hard, if not outright impossible. Hello world! without repetitions was hard enough that people had to resort to very niche languages or outright couldn't solve the task completely at all, and this one is considerably harder on top of that. \$\endgroup\$
    – FireFly
    Jan 23, 2014 at 17:29
  • 3
    \$\begingroup\$ Well, it sure is impossible in C. You can't call functions or use macros. \$\endgroup\$
    – Oberon
    Jan 23, 2014 at 17:50
  • \$\begingroup\$ I recommend: print the given string with as few repeated characters as possible. \$\endgroup\$
    – primo
    Jan 23, 2014 at 18:18
  • \$\begingroup\$ @FireFly didn't take long to have answers :) \$\endgroup\$
    – SirDarius
    Jan 23, 2014 at 19:10
  • \$\begingroup\$ @SirDarius apparently so. I'm impressed. \$\endgroup\$
    – FireFly
    Jan 23, 2014 at 19:12

5 Answers 5

33
\$\begingroup\$

Microsoft Word from 97 to 2003 (and some Mac Word versions) — 10 characters

No repetitions, but doesn't quite match specs - 10 characters:

=rand(2,1)

Output:

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

Matches specs, other than capitalization and punctuation, one repetition - 10 characters:

=rand(1,1)

Output:

The quick brown fox jumps over the lazy dog.

Newer versions of Microsoft Word use =rand.old(1,1) which duplicates d and 1.

There might be a way to use a field {=SUM(3,-2)} as input to rand() but my installation is having issues with fields -- namely, they're not working...

"Bob" has confirmed that {=SUM(3,-2)} (with some difficulty) can be used to replace the first 1, but = is repeated...

=rand({=SUM(3,-2)},1)

Provided you get Word to update SUM first, the output is:

The quick brown fox jumps over the lazy dog.
\$\endgroup\$
5
  • \$\begingroup\$ I'm not sure the given syntax is right, but I don't have any systems that old to test it on. For newer versions though, it should be =rand.old(1,1). I suppose you're trying to use 3-2 to replace the first 1, but it doesn't appear to be working for me in 2010 with rand.old or rand. \$\endgroup\$
    – Iszi
    Jan 23, 2014 at 19:02
  • \$\begingroup\$ I don't have a system here either, will check when I get home. Might need to use braces { ... } as delimiters, but I'm pretty sure expressions can be used in any function. If not, I'll revise! \$\endgroup\$
    – user15259
    Jan 23, 2014 at 19:14
  • 2
    \$\begingroup\$ I can confirm the {=SUM(3,-2)} works in Word 2007. But the method is a bit complicated. First, you must insert a field code (Ctrl + F9). Then, right click => edit field => formula => advanced => type in the formula. Because typing it in directly doesn't work for whatever reason. Now click in the field and evaluate with Shift + F9. And add the =rand.old() \$\endgroup\$
    – Bob
    Jan 24, 2014 at 4:45
  • \$\begingroup\$ Is it necessary to use =SUM, or could simply use arithmetic operators directly, as 3-2? \$\endgroup\$
    – supercat
    Jan 24, 2014 at 15:44
  • \$\begingroup\$ @supercat - We tried that, and for some reason, Word does not accept expressions as parameters of =rand(), e.g. =rand(3-2,1) would be perfect. I actually didn't try =rand({=3-2},1), but it should work the same way, with duplication of =. \$\endgroup\$
    – user15259
    Jan 24, 2014 at 16:03
17
\$\begingroup\$

Sclipting — 36 characters

덆둥긇굵늖꽫긆깲닷덮긂롦닲롸껂걪덖륰댲걯덦넬댢건늆넠닆굺뎒걤닶댬首坼

(expects empty input)

Explanation:

Push the string "the quick brown ,fo,x, jumps ove,r the lazy dog,"
덆둥긇굵늖꽫긆깲닷덮긂롦닲롸껂걪덖륰댲걯덦넬댢건늆넠닆굺뎒걤닶댬
Retrieve last character from the string (",")
首
Regular expression string-split
坼

The result is the list ["the quick brown ", "fo", "x", " jumps ove", "r the lazy dog", ""], which is automatically concatenated into a single string for output.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I count 105 bytes, not to mention several repeats. Char 235, for example, is used 20 times. \$\endgroup\$
    – primo
    Jan 23, 2014 at 21:52
  • 12
    \$\begingroup\$ "Must not repeat any characters", not "must not repeat any bytes". \$\endgroup\$
    – Plutor
    Jan 23, 2014 at 22:51
  • 3
    \$\begingroup\$ I'm not surprised Timwi, your own language is perfect for "no repeated characters" challenges. \$\endgroup\$ Jan 24, 2014 at 10:40
13
\$\begingroup\$

Perl 6 (76 chars, no doubles)

The script (will be mangled by the board software, but there's En Space up to Thin Space and NL and LF and tab)

say EVAL    lc q{<the Quiţk Brown fïX jUmpS ůvťɲ Tɨå ìšzY dOg>~&(127.CHR
x
43)}
  • It uses EVAL (thanks again for making it uppercase) and <foo bar> quote words which supports all the special space characters as word separators.
  • say joins the list of strings using space, works nicely here :)
  • Next I use ~& and 127 to bit shuffle to plain ascii. Extra complication: 'Ŭ'.lc becomes 'ŭ' so that becomes an s instead of the r I needed. Adding 128 some extra times helps :)

A version with backslash escapes instead of unicode characters to show they're all different

say\x[3000]EVAL\x[9]lc q{<the\x[2003]Qui\x[163]k\x[2004]Brown\x[2005]f\x[EF]X\x[2006]jUmpS\x[2007]\x[16F]v\x[165]\x[272]\x[2008]T\x[268]\x[E5]\x[2009]\x[EC]\x[161]zY\x[200A]dOg>~&(127.CHR\x[0A]x\x[0D]43)}

If you want to verify they're all unique, use this script (I used Qb"string" to have basic quoting with only backslash escapes)

.say for 
Qb"say\x[3000]EVAL\x[9]lc q{<the\x[2003]Qui\x[163]k\x[2004]Brown\x[2005]f\x[EF]X\x[2006]jUmpS\x[2007]\x[16F]v\x[165]\x[272]\x[2008]T\x[268]\x[E5]\x[2009]\x[EC]\x[161]zY\x[200A]dOg>~&(127.CHR\x[0A]x\x[0D]43)}"
.comb.Bag.grep(*.value > 1).map: {.key.ord.base(16) ~ " $_"  }

Or execute it directly using

EVAL Qb"say\x[3000]EVAL\x[9]lc q{<the\x[2003]Qui\x[163]k\x[2004]Brown\x[2005]f\x[EF]X\x[2006]jUmpS\x[2007]\x[16F]v\x[165]\x[272]\x[2008]T\x[268]\x[E5]\x[2009]\x[EC]\x[161]zY\x[200A]dOg>~&(127.CHR\x[0A]x\x[0D]43)}"
\$\endgroup\$
10
\$\begingroup\$

PHP - 67 bytes

<?echo$g^¶¥€¼½ˆ•.${~˜}=ÂÍåœÌýü¡¦Åþ¾’‹Ï†£‘ƲáºëÓâæÝ—ߙ󖎸·³ø‰ï®ÜØÔ;

Copy-Paste, save as Latin-1 (Ansi).

This is a 7-byte xor-cipher, using the string ¶¥€¼½ˆ• for salt.

One repeated character: $.

\$\endgroup\$
6
  • \$\begingroup\$ You can shorten it another 3 character by using <?= since you are already using short tags \$\endgroup\$ Jan 24, 2014 at 10:40
  • \$\begingroup\$ Ah, sorry, just noticed you already use = \$\endgroup\$ Jan 24, 2014 at 10:41
  • \$\begingroup\$ @KristofferSHansen I think it should be possible to use eval('Return$g=binary;') in some cryptic form (perhaps bit inversion) to avoid the $ repetition, and then the = would be freed up as well. \$\endgroup\$
    – primo
    Jan 24, 2014 at 10:48
  • \$\begingroup\$ The opening tag should not be included in the byte count. \$\endgroup\$
    – TecBrat
    Jan 24, 2014 at 14:04
  • \$\begingroup\$ @TecBrat The final ; can be replaced by closing tag: should that not be counted either? In short, I disagree. If your code doesn't run as-is, it's not a complete program. \$\endgroup\$
    – primo
    Jan 24, 2014 at 14:14
0
\$\begingroup\$

Haskell, 71 characters

map(\c->chr$mod(ord c)128)"tŨeఠquiţkĠbŲɯwnȠfѯxРjѵŭŰsܠůvťѲठѴѨѥਠlšzyଠɤկg"

Yet another 7-bit modulo solution.

Repeated characters:

c 3
d 2
m 2
o 2
r 2
( 2
) 2
" 2

First time golfing with Haskell; anyone more experienced in the language, feel free to improve. I wanted to make the anonymous function point-free to avoid having to mention a variable twice, but I don't know if it'd be a net benefit.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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