75
\$\begingroup\$

Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'.

Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order. However for each vowel aeiou, at least one of the programs must not include any occurrence of the vowel.

So there must be

  • a program that does not use 'a' or 'A' anywhere in the syntax of the program.
  • a program that does not use 'e' or 'E' anywhere in the syntax of the program.
  • a program that does not use 'i'  or 'I' anywhere in the syntax of the program.
  • a program that does not use 'o' or 'O' anywhere in the syntax of the program.
  • a program that does not use 'u' or 'U' anywhere in the syntax of the program.

All of them must output abcdefghijklmnopqrstuvwxyz.

The winner shall be the solution where the length of all programs is the shortest.

* since the constraint wouldn't be much of a challenge in Piet or Whitespace

\$\endgroup\$
21
  • 2
    \$\begingroup\$ if one manages to make a single program that does not contain any vowel, do we need multiply the length of the program by 5? \$\endgroup\$ Commented Apr 24, 2012 at 10:55
  • 5
    \$\begingroup\$ @w0lf: No, it says "up to 5 programs" and "length of all programs", which I read as "there can be only one program and its length counts in this case". \$\endgroup\$
    – schnaader
    Commented Apr 24, 2012 at 11:09
  • 10
    \$\begingroup\$ @PeterTaylor: You don't think having to avoid using vowels in your syntax is a unique challenge? As a JS programmer, it's especially interesting :) \$\endgroup\$
    – mellamokb
    Commented Apr 24, 2012 at 13:51
  • 2
    \$\begingroup\$ Are newlines acceptable in the output (i.e. one per character)? I can shorten some of my code if that is the case... \$\endgroup\$
    – Gaffi
    Commented Apr 24, 2012 at 21:17
  • 3
    \$\begingroup\$ I'm the OP. Uppercase not allowed. \$\endgroup\$
    – shamp00
    Commented Sep 17, 2016 at 5:21

123 Answers 123

1
2 3 4 5
48
\$\begingroup\$

Golfscript - 8 chars

123,97>+
\$\endgroup\$
5
  • 8
    \$\begingroup\$ damn, really can't beat golfscript in terms of conciseness... \$\endgroup\$ Commented Apr 25, 2012 at 11:12
  • 18
    \$\begingroup\$ That being said, the readability stinks like crazy. \$\endgroup\$ Commented Apr 9, 2013 at 17:25
  • 6
    \$\begingroup\$ It's not that bad ;) generate a list of 123 numbers, remove those who aren't greater than 97, coerce it (array of numbers) to a string. \$\endgroup\$
    – McKay
    Commented Jan 29, 2014 at 16:38
  • 6
    \$\begingroup\$ Use 91,65>+ instead. \$\endgroup\$ Commented Aug 3, 2016 at 17:00
  • 2
    \$\begingroup\$ Funny to read old comments marveling about how concise Golfscript is now that we have golfing languages like O5AB1E \$\endgroup\$
    – rydwolf
    Commented Aug 18, 2020 at 17:45
31
\$\begingroup\$

Brainfuck, 38 chars

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

There are, of course, no vowels (or any other letters) in brainfuck syntax.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Valid point there! ;) \$\endgroup\$ Commented Dec 16, 2013 at 0:17
  • 5
    \$\begingroup\$ 30 bytes: ++[[<+++>->++++<]>]<<<<++[->+.<] \$\endgroup\$
    – primo
    Commented Aug 7, 2016 at 3:13
24
\$\begingroup\$

PHP, 31 Bytes

No a,e,i,o,u:

<?=~žœ›š™˜—–•”“’‘ŽŒ‹Š‰ˆ‡†…;

The binary string after the tilde has the following hex representation:

\x9e\x9d\x9c\x9b\x9a\x99\x98\x97\x96\x95\x94\x93\x92\x91\x90\x8f\x8e\x8d\x8c\x8b\x8a\x89\x88\x87\x86\x85

Since there's a language scoreboard, I may as well submit this one as well:

Ruby (v1.8) 18 bytes

$><<[*97.chr..'z']
\$\endgroup\$
5
  • \$\begingroup\$ I'm not sure I understand how this works. Could I get an explanation? \$\endgroup\$
    – Mr. Llama
    Commented Apr 25, 2012 at 18:22
  • \$\begingroup\$ When applied to a string, the ~ operator inverts all of the bits. Here I've inverted abc...xyz. Because there are no symbols characters (or whitespace) in the binary string, quotes are not necessary either. \$\endgroup\$
    – primo
    Commented Apr 25, 2012 at 18:31
  • 1
    \$\begingroup\$ You may want to specify an encoding for what you have there. \$\endgroup\$
    – Joey
    Commented Apr 26, 2012 at 5:36
  • 1
    \$\begingroup\$ iso-8859-1. Three 'unprintable' characters were removed when it was posted, which is why I included the hex. \$\endgroup\$
    – primo
    Commented Apr 26, 2012 at 6:33
  • 2
    \$\begingroup\$ Nice and probably the shortest possible PHP version. A command to generate the file: php -r 'echo("<?=~\x9e\x9d\x9c\x9b\x9a\x99\x98\x97\x96\x95\x94\x93\x92\x91\x90\x8f\x8e\x8d\x8c\x8b\x8a\x89\x88\x87\x86\x85;");' > script.php. The command to run it: php -d error_reporting=0 script.php; echo. \$\endgroup\$
    – axiac
    Commented Aug 18, 2015 at 12:39
17
\$\begingroup\$

Pyth, 1 Character

G

Pyth predefines certain variables. G is predefined as the lowercase alphabet. Pyth also implicitly prints each line with a reasonable return value.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ Ninja'd me by 3 years... \$\endgroup\$
    – Stan Strum
    Commented Sep 6, 2017 at 3:23
16
\$\begingroup\$

Ruby (24 22)

Edit: parentheses can be omitted, 2 chars less:

$><<'%c'*26%[*97..122]

24 chars in Ruby:

$><<('%c'*26)%[*97..122]

How it works

$> is an alias for $stdout or STDOUT. You can write to it using the << operator. The term '%c'*26 repeats the string '%c' 26 times. The % operator is defined on String as an alias to sprintf, so str % val is equivalent to writing sprintf(str,val). The format character %c is used to transform a char value to a char. These values come from [*97..122] which creates an array containing the values from 97 to 122. Et voilá!

\$\endgroup\$
6
  • \$\begingroup\$ Very nice. I was looking for a way to use << but had forgotten about $>. \$\endgroup\$
    – Mark Reed
    Commented Apr 25, 2012 at 10:49
  • 1
    \$\begingroup\$ I didn't even know about $> before, but i guessed there had to be some dollar-variable alias for $stdout that no one can remember :) \$\endgroup\$ Commented Apr 25, 2012 at 11:04
  • \$\begingroup\$ 21 characters: $><<[*"`".."z"][1,26] (note: this only works in Ruby 1.8) \$\endgroup\$
    – Ventero
    Commented May 5, 2012 at 0:11
  • \$\begingroup\$ @Ventero not only in Ruby 1.8, in Ruby 1.9.2 works as well. But using p [*"".."z"][1,26]` is even shorter. \$\endgroup\$
    – Hauleth
    Commented Sep 14, 2012 at 9:57
  • \$\begingroup\$ @Hauleth: No, running it in 1.9 doesn't generate the correct output, as in 1.9 Array#to_s is the same as Array#inspect, whereas in 1.8 it's Array#join - so in 1.9 the output is ["a", "b", "c", "d", "e", ...] instead of abcdef.... For the same reason, p can't be used (it calls inspect on its arguments, instead of to_s). \$\endgroup\$
    – Ventero
    Commented Sep 14, 2012 at 10:08
15
\$\begingroup\$

JavaScript (100)

No 'aeou':

this['\x61l\x65rt']('\x61bcd\x65fghijklmn\x6fpqrst\x75vwxyz')

No 'i':

alert('abcdefgh\x69jklmnopqrstuvwxyz')
\$\endgroup\$
5
  • \$\begingroup\$ +1 Nice improvement on my answer :) I had thought about using the \x## codes but weren't sure if they were valid in JavaScript. \$\endgroup\$
    – mellamokb
    Commented Apr 24, 2012 at 16:28
  • \$\begingroup\$ why the alerts at all? on a js terminal, objects are echo'd automagically. ('\x61bcd\x65fghijklmn\x6fpqrst\x75vwxyz') @ 42 characters. \$\endgroup\$ Commented Apr 24, 2012 at 17:26
  • 3
    \$\begingroup\$ @antony.trupe, for code golf, IO is typically done via the language's built in IO mechanisms (or common plugins). For JS this is typically alert, confirm, prompt, console.log, and document.write. Simply declaring a string literal doesn't produce it as output when executed. Otherwise, you'd be correct, and I would have used that. \$\endgroup\$
    – zzzzBov
    Commented Apr 24, 2012 at 17:52
  • \$\begingroup\$ it produces output(by the definition I use anyways) in the google chrome console, but I concede the issue; it's an arbitrary restriction to begin with. \$\endgroup\$ Commented Apr 24, 2012 at 18:32
  • \$\begingroup\$ @antony.trupe, in a language like PHP you'd be able to get away with using a literal, because that's how it performs IO. \$\endgroup\$
    – zzzzBov
    Commented Apr 24, 2012 at 18:35
15
\$\begingroup\$

K,9

_26#.Q.b6

K,10

"c"$97+!26

K,14

.:".Q.","c"$97
\$\endgroup\$
2
  • 2
    \$\begingroup\$ and a silly way to do it with no letters at all (12 chars): (@$`)$97+!26 \$\endgroup\$ Commented Jan 20, 2014 at 9:56
  • 1
    \$\begingroup\$ The K5 way is nearly your second solution but $ takes symbols instead of strings to control the type converted into: `c$97+!26 \$\endgroup\$
    – JohnE
    Commented Jun 2, 2015 at 3:17
15
\$\begingroup\$

R, 17 + 19 = 36 characters

no ae (17):

intToUtf8(97:122)

no iou (19):

cat(letters,sep="")
\$\endgroup\$
15
\$\begingroup\$

J, 26 23 17 16 characters

After an hour or so rummaging around in J's underwear drawer I've finally found a way to eliminate the a. and u: verbs.

2(3!:4)96+#\26$1

Previously:

a.{~96++/\26$1
u:97+i.26

with thanks to randomra for the #\ trick.

\$\endgroup\$
2
  • \$\begingroup\$ Nice solution! Managed to shorten with 1 char using #\ instead of +/\ . \$\endgroup\$
    – randomra
    Commented Apr 9, 2013 at 0:47
  • 5
    \$\begingroup\$ Get out of my underwear drawer \$\endgroup\$
    – Joe
    Commented Dec 3, 2014 at 10:33
13
\$\begingroup\$

C, 90 88 84 characters

Compile using gcc -nostartfiles

b;_exit(){for(;b<26;)printf("%c",b+++97);}    // 42 chars, works for a, u
b;_start(){putchar(b+++97)>121?:_start();}    // 42 chars, works for e, i, o
\$\endgroup\$
5
  • \$\begingroup\$ _start and _exit are a nice way to get around main. But if a non-standard compilation line is OK, why not -DX=main? \$\endgroup\$
    – ugoren
    Commented Apr 24, 2012 at 12:53
  • 4
    \$\begingroup\$ Somehow, -DX=main feels worse than -nostartfiles does (for me). It is a way to move a part of the source code to the compilation line and it is the same as writing #define X main in the source code which would be clearly invalid. Whereas -nostartfiles isn't a way to rename main, but removes the restriction that there must be a main function (called in _start). On the other hand, using -nostartfiles does feel a bit like cheating, especially as it contains 4 of the 5 "bad" letters :) \$\endgroup\$
    – schnaader
    Commented Apr 24, 2012 at 13:21
  • \$\begingroup\$ It's a slippery slope... The distance from -nostartfiles to -DX=main is small, and then why not save some chars with -DX=main() and so forth. But I can't find a solution that doesn't involve anything fishy. \$\endgroup\$
    – ugoren
    Commented Apr 24, 2012 at 16:22
  • \$\begingroup\$ There's no way you can define the main function to be "mn" for instance? \$\endgroup\$
    – Neil
    Commented Apr 26, 2012 at 10:22
  • \$\begingroup\$ @Neil, only by doing something like -Dmn=main. A C function must have a main function unless a non-standard option like -nostartfiles is used. \$\endgroup\$ Commented Apr 29, 2012 at 3:17
13
\$\begingroup\$

Bash (38)

No vowels at all.

/*/*/*ntf "/*/?ch? {\x61..z}"|/*/b?sh
\$\endgroup\$
4
  • \$\begingroup\$ This program fails on my system, because /*/b?sh does not exist. I have /usr/local/bin/bash, not /bin/bash. \$\endgroup\$
    – kernigh
    Commented May 4, 2012 at 17:36
  • 2
    \$\begingroup\$ Nice use of shell globbing! \$\endgroup\$ Commented May 19, 2012 at 21:48
  • \$\begingroup\$ @kernigh [[ ! -d "/bin" ]] && mkdir "/bin"; sudo cp "/usr/local/bin/bash" "/bin/bash" \$\endgroup\$
    – Stan Strum
    Commented Jan 7, 2018 at 2:09
  • 1
    \$\begingroup\$ It would be better if /bin/sh is bash. Then the code can end with /*/sh (36 bytes). But I have not found a system where this works. In Debian, /bin/sh isn't bash. In my old Mac, /bin/sh is bash 2.05b0.(1), but this version is too old and doesn't expand {a..z}. \$\endgroup\$
    – kernigh
    Commented Jan 7, 2018 at 21:25
10
\$\begingroup\$

Golfscript, 10 characters

26,{97+}%+
\$\endgroup\$
1
  • 22
    \$\begingroup\$ Why so verbose? \$\endgroup\$ Commented Apr 24, 2012 at 13:43
9
\$\begingroup\$

BASH: 40 characters

  • No aeiou used.
  • No wildcard used.
`tr c-y '\141-w'<<<'rtkpvh %s c'` {b..z}
\$\endgroup\$
9
\$\begingroup\$

Ruby, 20 chars

$><<[*97.chr..?z]*''
  • 97.chr is an elaborate way of saying 'a'
  • .. specifies a Range
  • ?z is a shorter way of saying "z"
  • the [*range] causes the range to splat al it's values in an array
  • *'' is the same as join(''); it glues all array values together.
  • $><< Perlicism: print to stdout.
\$\endgroup\$
4
  • \$\begingroup\$ This code doesn't seem to work. ?z is not shorthand for 'z', but rather for 122. This, however, does work for 18 bytes: $><<[*97.chr..'z'] \$\endgroup\$
    – primo
    Commented Sep 13, 2012 at 7:17
  • \$\begingroup\$ It does work in Ruby 1.9. \$\endgroup\$
    – steenslag
    Commented Sep 13, 2012 at 14:42
  • 1
    \$\begingroup\$ I downloaded 1.9.3... and you're right. Why would they change something like that? I can see why anarchy golf is still running 1.8.7. Anyway, the 18 byte solution works for v1.8.7- \$\endgroup\$
    – primo
    Commented Sep 13, 2012 at 15:30
  • 2
    \$\begingroup\$ (4 years later...) You can replace 97.chr with ?\x61 for -1 byte. \$\endgroup\$
    – Jordan
    Commented Sep 16, 2016 at 5:46
9
\$\begingroup\$

dc: 18 17 characters

97[dP1+dBD>m]dsmx

And there died a brave character.

\$\endgroup\$
3
  • \$\begingroup\$ I doubt so. I'm wrapping head around it and I don't see any way to shorten it. I have ended with exactly same solution except I used x for register which makes mine solution more obfuscated. \$\endgroup\$ Commented Apr 21, 2013 at 21:01
  • 3
    \$\begingroup\$ 97[dP1+dBD>m]dsmx, 17 characters. Apparently you can always enter hexadecimal characters in DC, but as the input base is ten the value is B*10+D=11*10+13=123='{', and not 0xBD. \$\endgroup\$
    – Fors
    Commented Apr 21, 2013 at 22:53
  • \$\begingroup\$ Oh, nice glich ;-) \$\endgroup\$ Commented Apr 21, 2013 at 23:25
9
\$\begingroup\$

Powershell, 75 62 characters

Edit: Used -f (String.Format) and array indexing to significantly reduce the code length.

'{0}bcd{1}fgh{2}jklmn{3}pqrst{4}vwxyz'-f"$(1|gm)"[8,10,0,5,31]

How it works

gm is an alias for get-members, so 1|gm returns members of the value 1, which is of the System.Int32 type:

PS C:\> 1|gm
   TypeName: System.Int32
Name        MemberType Definition
----        ---------- ----------
CompareTo   Method     int CompareTo(System.Object value), int CompareTo(int value)
Equals      Method     bool Equals(System.Object obj), bool Equals(int obj)
GetHashCode Method     int GetHashCode()
...

"$(1|gm)" returns a string representation of the above list, which happens to contain all the vowels we need to complete the alphabet: "int CompareTo(System.Object value)..."

\$\endgroup\$
6
  • 2
    \$\begingroup\$ This isn't stable if MS adds members to System.Int32, though :-) \$\endgroup\$
    – Joey
    Commented Apr 26, 2012 at 5:12
  • \$\begingroup\$ I think that would have to be ($x=''+$(gv))[8]+"bcd$($x[4])fgh$($x[25])jklmn$($x[26])pqrst$($x[19])vwxyz" which is also 75 characters :) \$\endgroup\$ Commented Apr 26, 2012 at 7:02
  • \$\begingroup\$ Argh, right. I fished the wrong item from my history. Sorry. \$\endgroup\$
    – Joey
    Commented Apr 26, 2012 at 7:53
  • \$\begingroup\$ Actually, if you replace ''+$(gv) with "$(gv)" you get ($x="$(gv)")[8]+"bcd$($x[4])fgh$($x[25])jklmn$($x[26])pqrst$($x[19])vwxyz" which is 74 characters. Nice! \$\endgroup\$ Commented Apr 26, 2012 at 8:54
  • 2
    \$\begingroup\$ I used -f (String.Format) and array indexing to significantly reduce the code length. \$\endgroup\$
    – Tim Lewis
    Commented Mar 4, 2014 at 20:03
8
\$\begingroup\$

Haskell, 12

['\97'..'z']

Or is this cheating? :)

\$\endgroup\$
2
  • \$\begingroup\$ I admittedly don't know much about Haskell, but it gives me this error: Parse error: naked expression at top level \$\endgroup\$
    – primo
    Commented Dec 20, 2012 at 9:39
  • 2
    \$\begingroup\$ You run it in the interpreter \$\endgroup\$ Commented Dec 20, 2012 at 10:21
7
\$\begingroup\$

MATLAB, 12+20=32 characters

No eiou (12):

char(97:122)

No aeou (20)

fprintf('%s',97:122)
\$\endgroup\$
7
\$\begingroup\$

In Perl,

it's also possible without any vowels

but much harder than in Ruby etc. This uses a total of 101 chars but doesn't require cmd line (perl -e) invocation.

`\160\145\162\154\40\55\145\40\42\160\162\151\156\164\40\123\124\104\105\122\122\40\141\56\56\172\42`

=> Result: abcdefghijklmnopqrstuvwxyz

In contrast to the 'similar looking' PHP Solution, this is a real program. The program decoded reads:

perl -e "print STDERR a..z"

After encoding to octal values, another perl interpreter is called during run by the `` (backticks). The backticks would consume the output, therefore it's printed to STDERR.

The encoding is done by sprintf:

my $s = q{perl -e "print STDERR a..z"};
my $cmd = eval(
       '"' . join('', map sprintf("\\%o",ord $_), split //, $s) . '"'
       );

and the eval'd encoding is the program posted (within backticks):

"\160\145\162\154\40\55\145\40\42\160\162"
"\151\156\164\40\123\124\104\105\122\122"
"\40\141\56\56\172\42"

Regards

rbo

\$\endgroup\$
1
  • 9
    \$\begingroup\$ You could shorten this to 44 characters by only encoding the vowels :) \$\endgroup\$
    – marinus
    Commented Apr 30, 2012 at 22:35
7
\$\begingroup\$

Perl 5, 22 characters

(1) only contains a and e, 10 chars (requires 5.10+, run from the command line):

-Esay+a..z

(2) only contains 'i', 12 chars:

print v97..z

If not allowed to run from the command line, then you need to use use 5.01;say a..z for the first one, at a cost of 7 characters and one more vowel, but it still has no 'i', so it results in a valid entry at 29 total characters.

\$\endgroup\$
5
  • \$\begingroup\$ The '-E' option is ok I think, but usually the 2 characters '-E' are added into the total character length. \$\endgroup\$
    – Gareth
    Commented Apr 24, 2012 at 15:56
  • \$\begingroup\$ @gareth - the -E takes the place of -e for running a one-liner. If you're running a program from a file, then you're stuck with the use, although you could replace it with the command line option -M5.01 and shave off two more characters. \$\endgroup\$
    – Mark Reed
    Commented Apr 24, 2012 at 16:17
  • \$\begingroup\$ I was thinking of the rule with the -p option where 2 characters are added to the count. Looking at this meta question though, you should be able to use the -M5.010 for free if that option helps shorten your code. \$\endgroup\$
    – Gareth
    Commented Apr 24, 2012 at 16:29
  • \$\begingroup\$ you could replace your print statement with die to shave off 2 chars \$\endgroup\$
    – ardnew
    Commented Apr 30, 2012 at 20:49
  • \$\begingroup\$ chr 97..z may be replaced with v97..z for 3 bytes. \$\endgroup\$
    – primo
    Commented Jul 24, 2013 at 7:01
7
\$\begingroup\$

APL (Dyalog) (11 13)

You might need an APL font. This is supposed to be Unicode but there's no preview...

Only U (and perhaps if counting Greek vowels):

⎕UCS 96+⍳26

(That's: [quad]UCS 96+[iota]26)

Only A:

⎕A
\$\endgroup\$
3
  • 2
    \$\begingroup\$ U is a vowel... \$\endgroup\$
    – Tobia
    Commented Jul 24, 2013 at 23:26
  • \$\begingroup\$ @Tobia: and it took over a year for someone to see that (including me). I guess iota is actually also a vowel now that I'm thinking about it. Fixed it. \$\endgroup\$
    – marinus
    Commented Jul 25, 2013 at 20:35
  • \$\begingroup\$ The APL functional symbol iota (U+2373) is not considered a letter in Unicode, and therefore can't be a vowel. Note, that it is distinct from the Greek small letter iota (U+03B9). \$\endgroup\$
    – ngn
    Commented Jun 13, 2014 at 9:31
7
\$\begingroup\$

Python 2, 83

No a, i, o or u; 47:

x=97;s='';exec"s+=chr(x);x+=1;"*26+"pr\x69nt s"

No e; 36:

print"abcd\x65fghijklmnopqrstuvwxyz"
\$\endgroup\$
6
\$\begingroup\$

Ruby, 22

$><<[*?`..?{][1,26]*''

No letters whatsoever :)

\$\endgroup\$
6
\$\begingroup\$

Python 2, 175 characters

Note: prints to output unlike earlier python answer.

Uses 'e', but no a,i,o,u - 63 61 59 65 (fix mistaken i move to lowercase) 115 chars (get rid of spaces).

exec('fr%cm sys %cmp%crt*\nf%cr x %cn r%cnge(97,123):std%c%ct.wr%cte(chr(x)),'%(111,105,111,111,105,97,111,117,105))

(Originally, it used print with a comma that inserted a space; also printed upper case letters. Now saw stringent requirements for 'abcdefghijklmnopqrstuvwxyz' as output; so adding import statement).

Doesn't use 'e' (uses a,i,o,u; could trivially get rid of a,u for small extension) - 61 60 chars

import string
print string.__dict__['low%crcas%c'%(101,101)]
\$\endgroup\$
4
  • 1
    \$\begingroup\$ Your first solution does use the letter i, so it should be: exec('f%cr x %cn r%cnge(65,91):pr%cnt chr(x),'%(111,105,97,105)) and we're back to 64 characters. \$\endgroup\$
    – BioGeek
    Commented Apr 26, 2012 at 11:02
  • 1
    \$\begingroup\$ exec('fr%cm sys i mp%crt*\nf%cr... \$\endgroup\$
    – Gareth
    Commented Apr 26, 2012 at 14:20
  • \$\begingroup\$ BioGeek & @Gareth - my manual vowel detection skills suck. Thanks for point it out; but I had an extra e written as a '%c' so in the end it evens out. \$\endgroup\$
    – dr jimbob
    Commented Apr 26, 2012 at 15:58
  • \$\begingroup\$ You can remove the parentheses from exec('...') \$\endgroup\$
    – mbomb007
    Commented Sep 16, 2016 at 16:52
5
\$\begingroup\$

JavaScript (154)

(1) Only contains i (99 chars):

t=this;s=-t+t+t.b;z=s[1]+'bcd'+s[7]+'fghijklmn'+s[4]+'pqrst'+s[21]+'vwxyz';t[s[1]+'l'+s[7]+'rt'](z)

(2) Only contains aeou (55 chars):

t=0;s=''+t.b;alert('abcdefgh'+s[5]+'jklmnopqrstuvwxyz')

Demo: http://jsfiddle.net/SvN5n/

\$\endgroup\$
1
  • \$\begingroup\$ $("h\x65\x61d")[0]["\x6fwn\x65rD\x6fc\x75m\x65nt"]["l\x6fc\x61t\x69\x6fn"]="j\x61v\x61scr\x69pt:\x65v\x61l(`f\x6fr(s='',l=65;l<90;l++){s=s+Str\x69ng.fr\x6fmCh\x61rC\x6fd\x65(l);};c\x6fns\x6fl\x65.l\x6fg(s)`)" 208chars, no aeoui used in code. Works on chrome browser. \$\endgroup\$ Commented Oct 3, 2019 at 10:09
5
\$\begingroup\$

Python 159 117

As mentioned in the other python post the hardest part is dealing with the fact that the only way to output is to use print or sys.stdout.write, both of which contain i. Have to do it with 2 programs (which are freestanding and don't use the python interactive shell to create the output):

This one only uses i for 55 chars:

print"%cbcd%cfghijklmn%cpqrst%cvwxyz"%(97,101,111,117)

This one avoids using i for 104 chars:

eval("sys.stdout.wr%cte"%105,{'sys':eval("__%cmport__('sys')"%105)})("%c"*26%tuple(range(97,123))+"\n")

EDIT: Massive breakthrough!!! I was thinking that use of eval (or even exec) was a bit of a cheat and not truly in the spirit of the competition. Anyway, trawling through the builtins I found a way to get hold of the print function without using i. So here is the avoid-i (and o) program for 68 chars:

vars(vars().values()[0])['pr%cnt'%105]("%c"*26%tuple(range(97,123)))

But because that also avoids o, this can be paired with one that only avoids a, e, u for 49 chars:

print"%cbcd%cfghijklmnopqrst%cvwxyz"%(97,101,117)
\$\endgroup\$
1
  • \$\begingroup\$ You can toss away compatibility, and gain a character - vars(vars().values()[0]).values()[47] \$\endgroup\$
    – ugoren
    Commented May 6, 2012 at 20:43
5
\$\begingroup\$

Ruby 196 164 44 47

$><<"\x61bcd\x65fgh\x69jklmn\x6Fpqrst\x75vwxyz"
\$\endgroup\$
4
  • \$\begingroup\$ Is this a valid answer, since p outputs quotation marks around the alphabet? \$\endgroup\$
    – Mark Reed
    Commented Apr 24, 2012 at 14:51
  • \$\begingroup\$ i agree p x is equivalent to calling puts str.inspect, which results in surrounding quotation marks. \$\endgroup\$ Commented Apr 25, 2012 at 11:13
  • \$\begingroup\$ @padde you are both right; changed. \$\endgroup\$ Commented Apr 25, 2012 at 11:52
  • 1
    \$\begingroup\$ @padde I used your $><<, so +1 for that and congratulations; your version is much better \$\endgroup\$ Commented Apr 25, 2012 at 11:54
5
\$\begingroup\$

VBA: 76 brute force, 116 without 'cheating' (98 if newlines are acceptable in the output)

Standard Functions

Thanks to VBA's verbosity, I don't believe this can be done without 'E' or 'U' in a standard code module...

  • "E nd"
  • "F u nction"
  • "S u b"

Immediate Functions

Running with mellamokb's assumption, here's without the function declaration (leaving out SUB and FUNCTION) (116 chars, 98 if newlines are acceptable in output):

The below uses neither 'e' nor 'a' (43 chars, formatted to run in the immediate window):

b=65:Do:z=z+Chr(b):b=b+1:Loop Until b=91:?z

The below uses neither 'i' nor 'a' nor 'u' (33 chars, formatted to run in the immediate window):

For b=65 To 90:z=z+Chr(b):Next:?z

The below uses neither 'a' nor 'o' nor 'u' (40 chars, formatted to run in the immediate window):

b=65:While b<91:z=z+Chr(b):b=b+1:Wend:?z

If newline characters are allowed in the output, then the above examples can be shorter:

(37 chars)

b=65:Do:?Chr(b):b=b+1:Loop Until b=91

(27 chars)

For b=65 To 90:?Chr(b):Next

(34 chars)

b=65:While b<91:?Chr(b):b=b+1:Wend

Brute Force

Running with w0lf's Ruby answer

(76 chars, formatted to run in the immediate window):

?Chr(65)&"BCD"&Chr(69)&"FGH"&Chr(73)&"JKLMN"&Chr(79)&"PQRST"&Chr(85)&"VWXYZ"
\$\endgroup\$
5
  • 1
    \$\begingroup\$ I think it would be fair to leave Sub..End Sub out, since most other programs don't include function definition. \$\endgroup\$
    – mellamokb
    Commented Apr 24, 2012 at 13:52
  • \$\begingroup\$ @mellamokb Well, that makes me feel better. I'll whip up some examples to add to this. \$\endgroup\$
    – Gaffi
    Commented Apr 24, 2012 at 13:53
  • 2
    \$\begingroup\$ Just think of it as "code you run in the immediate window" :) \$\endgroup\$
    – mellamokb
    Commented Apr 24, 2012 at 13:54
  • 2
    \$\begingroup\$ Well, if in doubt just call it VBScript which can be included in a file without needing a Sub :) \$\endgroup\$
    – Joey
    Commented Apr 26, 2012 at 9:13
  • \$\begingroup\$ Fixed a bunch of needless spaces, changed print to ? since that works in the immediate window. \$\endgroup\$
    – Gaffi
    Commented Dec 19, 2012 at 20:42
5
\$\begingroup\$

Rebmu: 15 characters

Ctc'`L26[pn++C]

Reading Rebmu always requires a bit of unmushing to start with:

c: tc '` l 26 [pn ++ c]

Then it helps to expand the abbreviations:

c: to-char-mu '`
loop 26 [
    prin ++ c
]

It would be more obvious using a character literal for the predecessor of lowercase a:

c: #"`"
loop 26 [
    prin ++ c
]

But that doesn't "mush", so converting a word literal to a character passes for the same purpose. What I like about it, as with most Rebmu, is that it has the spirit of a sensible program despite the compression. (The Golfscript answer is shorter but doesn't map to the way a programmer would usually think when coding.)

\$\endgroup\$
5
\$\begingroup\$

<>< (Fish) - 22 characters

Because <>< uses the 'o' to print a character, this challenge seems impossible to do. Luckily, fish can change its own code in runtime. This allowed me to add the print instruction to the code.

This code uses none of the vowels:

'`78'+11pv
:X:'z'=?;>1+

You can run the code here

\$\endgroup\$
1
2 3 4 5

Your Answer

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

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