# The Challenge:

Print every 2 letter word acceptable in Scrabble using as few bytes as possible. I have created a text file list here. See also below. There are 101 words. No word starts with C or V. Creative, even if nonoptimal, solutions are encouraged.

AA
AB
...
ZA


# Rules:

• The outputted words must be separated somehow.
• Case does not matter, but should be consistent.
• Trailing spaces and newlines are allowed. No other characters should be outputted.
• The program should not take any input. External resources (dictionaries) cannot be used.
• No standard loopholes.

Wordlist:

AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY
BA BE BI BO BY
DE DO
ED EF EH EL EM EN ER ES ET EX
FA FE
GO
HA HE HI HM HO
ID IF IN IS IT
JO
KA KI
LA LI LO
MA ME MI MM MO MU MY
NA NE NO NU
OD OE OF OH OI OM ON OP OR OS OW OX OY
PA PE PI
QI
RE
SH SI SO
TA TI TO
UH UM UN UP US UT
WE WO
XI XU
YA YE YO
ZA

• Do the words have to be outputted in the same order? – Sp3000 Aug 13 '15 at 3:26
• @Sp3000 I'll say no, if something interesting can be thought up – qwr Aug 13 '15 at 3:29
• Please clarify what exactly counts as separated somehow. Does it have to be whitespace? If so, would non-breaking spaces be allowed? – Dennis Aug 13 '15 at 14:14
• Ok, found a translation – Mikey Mouse Aug 13 '15 at 15:16
• Vi isn't a word? News to me... – jmoreno Aug 15 '15 at 15:23

# Python 3, 194 188 bytes

s="BI ODEXIF BAAX ASOHER LOXUMOPAGOR KI US AMY BOITONOSI MMEMINANEHI UPI AYAHOYOWOMUNUHAID PEFARED QIS BEN JOFETAE KAT ABYESHMALI UTI ZADOELAWE "
while s:" "in s[:2]or print(s[:2]);s=s[1:]


Almost definitely not the shortest method, but I thought this would be a good start. Try to pack each pair into paths by overlapping as much as possible (e.g. "ODEX..." = ["OD", "DE", "EX", ...]). Spaces are used to separate paths, and any pairs with a space in it is removed (the trailing space is to prevent a single E from being printed at the end).

I also tried regex golfing this but it was longer.

• +1 nice approach! I Borrowed your string for a Ruby answer – daniero Aug 13 '15 at 20:52
• I also made an answer based on your idea using bash and regex – sergioFC Aug 14 '15 at 10:36
• +1 for AYAHOYOWOMUNUHAID! – Level River St Aug 15 '15 at 0:02

# CJam, 96 94 bytes

0000000: 31 30 31 2c 22 5a 0a d0 fd 64 f6 07 a3 81 30 f2  101,"Z...d....0.
0000010: c2 a5 60 0c 59 0f 14 3c 01 dd d1 69 7d 66 47 6e  ...Y..<...i}fGn
0000020: db 54 e5 8f 85 97 de b9 79 11 35 34 21 cb 26 c3  .T......y.54!.&.
0000030: f0 36 41 2b b4 51 fb 98 48 fc cb 52 75 1f 1d b1  .6A+.Q..H..Ru...
0000040: 6b c3 0c d9 0f 22 32 36 30 62 33 36 62 66 7b 3c  k...."260b36bf{<
0000050: 31 62 32 35 6d 64 2d 35 35 7d 27 41 66 2b        1b25md-55}'Af+


The above is a hexdump, which can be reversed with xxd -r -c 16 -g 1.

Try it online in the CJam interpreter.

Depending on what exactly counts as separated somehow, the byte count could be lowered to 93 or even 92:

• If we replace -55 with 59, the words will be separated by non-breaking spaces (0xA0).

• If we replace -55 with W, the words will be separated by at-signs (0x40).

### Idea

We can encode each pair of letters xy as (ord(x) - 65) × 25 + (ord(y) - 65).1

Instead of storing the resulting integers, we'll store the differences of all pairs that correspond to two adjacent words (sorted alphabetically).

The highest difference is 35, so we consider them digits of a base 36 integer and convert that integer into a a byte string.

### Code

101,   e# Push [0 ... 100].
"…"    e# Push the string that encodes the differences/increments.
260b   e# Convert from base 260 to integer.
36b    e# Convert from integer to base 36 (array).
f{     e# For each I in [0 ... 100]:
e#   Push the base 36 array.
<    e#   Keep it's first I elements.
1b   e#   Compute their sum.
25md e#   Push quotient and residue of the sum's division by 25.
-55  e#   Push -55 = '\n' - 'A'.
}      e#
'Af+   e# Add 'A' to all resulting integers. This casts to Character.


1 Since the second letter is never a Z, using 25 instead of 26 is enough.

## PHP 224, 218, 210 206

foreach(explode(",","I19SR,9ZY8H,,CNK,5JRU0,H,CN4,G0H,H160,CN4,75,CU9,AMIHD,MTQP,HQOXK,7L,74,G,CXS,CU9,HTOG,,CNK,MHA8,CNL,1")as$a){$b++;for($c=0;$c<26;$c++)echo base_convert($a,36,10)&pow(2,$c)?chr(96+$b).chr(97+$c)." ":"";}  aa ab ad ae ag ah ai al am an ar as at aw ax ay ba be bi bo by de do ed ef eh el em en er es et ex fa fe go ha he hi hm ho id if in is it jo ka ki la li lo ma me mi mm mo mu my na ne no nu od oe of oh oi om on op or os ow ox oy pa pe pi qi re sh si so ta ti to uh um un up us ut we wo xi xu ya ye yo za  Definitely not a great score, but I liked the challenge. I create a table of the options, created a bitwise system to flag which options are valid. Then I base-36 encoded those options to get the string: "I19SR,9ZY8H,,CNK,5JRU0,H,CN4,G0H,H160,CN4,75,CU9,AMIHD,MTQP,HQOXK,7L,74,G,CXS,CU9,HTOG,,CNK,MHA8,CNL,1"  Note the 3rd entry in that string array doesn't have a value, because C has no options. To print the values, I just convert the valid options to chars. There might be something I could do to reduce recognising that there are no words ending in C, J, K, Q, V or Z, but I can't think of a method to reduce it atm. By transposing the table, there are more empty elements and the data encodes a little more compactly which shaved off a few bytes. The array is now printed in a different order: foreach(explode(",","UB1YB,1,,CUP,CLMEJ,CUO,1,SG0H,5J9MR,,,H,MX01,MTXT,CYO5M,MTQ8,,CNL,MTXT,MHAP,50268,,CN5,CNL,FSZ,,")as$a){$b++;for($c=0;$c<26;$c++)echo base_convert($a,36,10)&pow(2,$c)?chr(97+$c).chr(96+$b)." ":"";}


aa ba fa ha ka la ma na pa ta ya za ab ad ed id od ae be de fe he me ne oe pe re we ye ef if of ag ah eh oh sh uh ai bi hi ki li mi oi pi qi si ti xi al el am em hm mm om um an en in on un bo do go ho jo lo mo no so to wo yo op up ar er or as es is os us at et it ut mu nu xu aw ow ax ex ox ay by my oy


Thanks to Ismael for the explode and for loop hints.

foreach(explode(3,UB1YB3133CUP3CLMEJ3CUO313SG0H35J9MR333H3MX013MTXT3CYO5M3MTQ833CNL3MTXT3MHAP35026833CN53CNL3FSZ)as$d)for($e++,$f=0;$f<26;$f++)echo base_convert($d,36,10)&pow(2,$f)?chr(97+$f).chr(96+$e)." ":"";  With an update to php5.6, pow(,) can be replaced by ** saving another 4 bytes. foreach(explode(3,UB1YB3133CUP3CLMEJ3CUO313SG0H35J9MR333H3MX013MTXT3CYO5M3MTQ833CNL3MTXT3MHAP35026833CN53CNL3FSZ)as$d)for($e++,$f=0;$f<26;$f++)echo base_convert($d,36,10)&2**$f?chr(97+$f).chr(96+$e)." ":"";

• Instead of exploding by ",", you can use explode(0,UB1YB0100CUP[...]) – Ismael Miguel Aug 13 '15 at 15:11
• Wouldn't that break since there are 0s in the encoding? – James Webster Aug 13 '15 at 15:13
• However.. there isn't a 3 I can use that! Thanks – James Webster Aug 13 '15 at 15:16
• Also, you can replace $e++;for($f=0;$f<26;$f++) with for($e++,$f=0;$f<26;$f++), and now you can remove those pesky {}. And if you want to convert chars to lowercase, use $e^' '. – Ismael Miguel Aug 13 '15 at 15:41 • Good catch! I wouldn't have got that one. – James Webster Aug 13 '15 at 15:43 # Perl, 167164 157 bytes "AMAEDOXUHALAXISHENUNUPABEFAHIDEMYESOHOSITAAGOYAYAWOWETOINODOREX KIFEHMMER BYONELI BOEMUS PELOMI UMOFAD BATAR KANAS JOPI UTI ZAI BI QI"=~/$_/&&say for AA..ZZ


Wrote a separate script to group the letters together as compact as possible into a string that contained all the valid 2 letter words. This then iterates over all of the two letter words and prints the valid ones, one per line. Run with perl -M5.10.1 script.pl.

• I can't get this to work in an online compiler. – mbomb007 Aug 14 '15 at 20:00
• @mbomb007 Depending on the version, you either need the command line flag -M5.10.1 to use the say keyword added in that version, or add use feature 'say'; in the body of the script. – AKHolland Aug 15 '15 at 12:45

# Java, 484448407391 389 bytes

My first try

public static void main(String[]a){int[]x={57569742,35784706,0,2099200,5534148,35651584,2048,35792896,5247168,2048,33685504,33687552,35794978,35653664,7746958,35782656,131072,2097152,395264,33687552,551296,0,2099200,131104,35653632,33554432};for(Integer i=0;i<26;i++){for(int z=0;z<26;z++){if("".format("%26s",i.toString(x[i],2)).charAt(z)=='1'){System.out.format("%c%c ",'A'+i,'A'+z);}}}}


Formatted:

public static void main(String[] a) {
int[] x = { 57569742, 35784706, 0, 2099200, 5534148, 35651584, 2048, 35792896, 5247168, 2048, 33685504, 33687552, 35794978, 35653664,
7746958, 35782656, 131072, 2097152, 395264, 33687552, 551296, 0, 2099200, 131104, 35653632, 33554432 };
for (Integer i = 0; i < 26; i++) {
for (int z = 0; z < 26; z++) {
if ("".format("%26s", i.toString(x[i], 2)).charAt(z) == '1') {
System.out.format("%c%c ", 'A' + i, 'A' + z);
}
}
}
}


Try it online

• Nice job! Some suggestions: java.lang.Exception can just be called Exception. "args" can be just "a". String.format() can be "".format(). There is also a little extra spacing in the main() declaration. Nice approach overall though, +1 from me :) – jrich Aug 13 '15 at 16:57
• I've just been playing with the print statement, but you beat me to it! You can save another byte by replacing \n with just a space. They don't have to be separated by new lines. – James Webster Aug 14 '15 at 9:35
• You've also missed a few spaces that you can remove. – James Webster Aug 14 '15 at 9:37
• @JamesWebster thx for the hints. – griFlo Aug 14 '15 at 10:11
• "".format is painful to look at, but hilarious. – codebreaker Aug 14 '15 at 19:59

## Matlab, 177 bytes

Generate a binary matrix defining all allowed pairs of letters, reshape it and base-64 encode it. The base-64 encoded string ('CR+ ... % ') is used as data in the program. The program reverses operations to unpack the matrix, and then reads the allowed pairs:

x=de2bi('CR+"''        1$$L*\"%!! ! !04P@<W( 0 1"%$$100@RZP4  $$0 ! 1$$1 0  P (    $0 0$ ! # %  '-32)';[i,j]=find(reshape(x(1:650),26,[])');char([j i]+64)

• Nice one Luis! Golfing is actually kind of fun... =P – Stewie Griffin Aug 14 '15 at 7:56
• Nice! There is no alphabet! – Brain Guider Aug 14 '15 at 9:07
• hats off. This is the most cryptic matlab code i've seen in ages ... – Hoki Aug 14 '15 at 15:32
• Thanks guys! It's only cryptic because of the base-64 encoding. That string actually packs the 26x25 binary matrix of allowed letter pairs – Luis Mendo Aug 14 '15 at 21:31

# Ruby, 166 bytes

Borrowing sp3000's neat method for encoding the words into a compact string. The kicker here is the short method for decoding it back into the two-letter words: Using a lookahead in the regex passed to String's scan method in order to extract overlapping matches, not containg space:

puts "BI ODEXIF BAAX ASOHER LOXUMOPAGOR KI US AMY BOITONOSI MMEMINANEHI UPI AYAHOYOWOMUNUHAID PEFARED QIS BEN JOFETAE KAT ABYESHMALI UTI ZADOELAWE".scan /(?=(\w\w))/


# Ruby, 179 bytes

My own approach: Generate all two-letter words between AA and ZA, and select the valid ones using a base 36 encoded bitmask:

i=-1
puts ("AA".."ZA").select{|w|"djmsjr5pfw2omzrfgydo01w2cykswsrjaiwj9f2moklc7okcn4u2uxyjenr7o3ub90fk7ipdq16dyttg8qdxajdthd6i0dk8zlmn5cmdkczrg0xxk6lzie1i45mod7".to_i(36)[i+=1]>0}


# C,155 bytes

Golfed version

i,v;main(){for(;++i-408;" >b  Ùc :oÒ¹ i ;¹ w so@)ia ¥g¨¸ ´k¦ase    Ù{§k {"[i/8]>>i%8&1||printf("%c%c%c ",i/8%2*v,i/16+65,!(i/8%2)*v))v="YUOIEMHA"[i%8];}


Output

YA HA AA BY BO BI BE BA AB DO DE OD ID ED AD YE OE HE AE FE FA OF IF EF GO AG UH OH EH AH OI HI AI JO KI KA LO LI LA EL AL MY MU MO MI ME MM MA UM OM EM HM AM NU NO NE NA UN ON IN EN AN YO HO PI PE PA UP OP QI RE OR ER AR SO SI SH US OS IS ES AS TO TI TA UT IT ET AT WO WE OW AW XU XI OX EX AX OY AY ZA


Ungolfed version

The 51-byte magic string in the golfed version contains many characters beyond ASCII 126, which have almost certainly been mangled into Unicode equivalents. The ungolfed version uses hex instead, and as a constant rather than a literal. Also, the ungolfed version separates the words with a newline, which makes it easier to copy and paste into Excel, order the list and compare with the required one.

char a[]=
{0xFF,0x3E ,0x62,0x7F ,0xFF,0xFF ,0xEB,0x63 ,0xFF,0x3A ,0x6F,0xE3 ,0xFB,0x7F ,0xFF,0x69 ,0xFF,0x3B
,0xFB,0xFF ,0x77,0xFF ,0x73,0x6F ,0x40,0x29 ,0x69,0x61 ,0xFF,0xBE ,0x67,0xF9 ,0xF7,0xFF ,0xEF,0x6B
,0xB3,0x61 ,0x73,0x65 ,0xFF,0xFF ,0xFF,0xFF ,0xEB,0x7B ,0xF5,0x6B ,0xFF,0x7B ,0x7F};

//iterate through i = 16*letter + 8*order + vowel
i,v;main(){for(;i++-408;a[i/8]>>i%8&1||printf("%c%c%c\n",i/8%2*v,i/16+65,!(i/8%2)*v))v="YUOIEMHA"[i%8];}


Explanation

If we expand the definition of vowel to include the 8 letters AHMEIOUY, we observe that all words consist of one vowel and one other letter (which may or may not be a vowel.) Therefore, for all the words ending in a vowel, we need a table of 26 bytes, one for each first letter, with the individual bits corresponding to the vowel. We need a similar table for the words starting with a vowel, except that this time we only need 25 bytes, as there is no word ending in Z. The two tables are riffled together to create the final table.

In order to avoid any ASCII codes in the region 0..31, the two least common "vowels" M and H are assigned to the 6th and 7th bit, and the encoding considers 1 for an invalid word and 0 for a valid word. Since there is no consonant which pairs with both M and H it is possible to ensure at least one of these bits is a 1.

The 8th bit is assigned to A, which is the most common vowel, to try to limit the non-ASCII characters (still there are rather a lot of them.)

The tables used are below. For words containing 2 vowels, I gave priority to the first letter as being considered the "vowel" and the second letter as the "letter." An exception to this is words starting with M, as this avoids a clash between MM and HM.

Hex encoding of words starting with a vowel

3E 7F FF 63 3A E3 7F 69 3B FF FF 6F 29 61 BE F9 FF 6B 61 65 FF FF 7B 6B 7B

AA AB    AD AE    AG AH AI       AL AM AN          AR AS AT       AW AX AY
HA          HE          HI          HM    HO

ED    EF    EH          EL EM EN          ER ES ET          EX
ID    IF                      IN             IS IT
OD OE OF    OH OI          OM ON     OP   OR OS          OW OX OY
UH             UM UN     UP       US UT
YA          YE                            YO


Hex encoding of words ending with a vowel

 A  H  M  E  I  O  U  Y
FF
BA       BE BI BO    BY  62
FF
DE    DO        EB
FF
FA       FE              6F
GO        FB
FF
FF
JO        FB
KA          KI           77
LA          LI LO        73
MA    MM ME MI MO MU MY  40
NA       NE    NO NU     69
FF
PA       PE PI           67
QI           F7
RE              EF
SH      SI  SO       B3
TA          TI  TO       73
FF
FF
WE     WO       EB
XI     XU    F5
FF
ZA                       7F

• Maybe make a hexdump of the golfed version so the mangling can be reverted easily – masterX244 Sep 20 '15 at 15:23

Warning, this answer is not programmatically interesting.

Since all words are two characters long, we can smash them all together and then rip them apart again using a simple regular expression.

Any regex-friendly language can do this, some more efficiently than others:

# Grep (via Bash), 215 bytes

grep -o ..<<<AAABADAEAGAHAIALAMANARASATAWAXAYBABEBIBOBYDEDOEDEFEHELEMENERESETEXFAFEGOHAHEHIHMHOIDIFINISITJOKAKILALILOMAMEMIMMMOMUMYNANENONUODOEOFOHOIOMONOPOROSOWOXOYPAPEPIQIRESHSISOTATIT


# Javascript, 224 bytes

alert("AAABADAEAGAHAIALAMANARASATAWAXAYBABEBIBOBYDEDOEDEFEHELEMENERESETEXFAFEGOHAHEHIHMHOIDIFINISITJOKAKILALILOMAMEMIMMMOMUMYNANENONUODOEOFOHOIOMONOPOROSOWOXOYPAPEPIQIRESHSISOTATITOUHUMUNUPUSUTWEWOXIXUYAYEYOZA".match(/../g))


# Perl, 225 bytes

 $_="AAABADAEAGAHAIALAMANARASATAWAXAYBABEBIBOBYDEDOEDEFEHELEMENERESETEXFAFEGOHAHEHIHMHOIDIFINISITJOKAKILALILOMAMEMIMMMOMUMYNANENONUODOEOFOHOIOMONOPOROSOWOXOYPAPEPIQIRESHSISOTATITOUHUMUNUPUSUTWEWOXIXUYAYEYOZA";s/../$&\n/g;print


# Python, 245 bytes

import re


As a note, some of the answers here are longer than echo, which I'd consider a baseline:

# POSIX shell, 307 bytes

echo AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY BA BE BI BO BY DE DO ED EF EH EL EM EN ER ES ET EX FA FE GO HA HE HI HM HO ID IF IN IS IT JO KA KI LA LI LO MA ME MI MM MO MU MY NA NE NO NU OD OE OF OH OI OM ON OP OR OS OW OX OY PA PE PI QI RE SH SI SO TA TI TO UH UM UN UP US UT WE WO XI XU YA YE YO ZA

• +1 for being practical. Really, providing the base echo is the point everyone should start from. – metalim Aug 15 '15 at 10:18
• +1 on easy answer, but you should be marking that as non competing, shouldn't you? – lol Jan 24 '17 at 1:32
• @MatthewRoh – If there were a leader-board parser, it would probably fail to find anything since I intentionally didn't start with a heading. I'm not worried, especially since there are shorter answers for every language I've posted. – Adam Katz Jan 24 '17 at 1:55

# Bash, 179 bytes

echo Used -r 's/./& &/g'<<<HAABADEDOEFAEHELAGOFEMAHINAISHMENERESITALOHOMMONOPAMUMYAWETOSOWOYOXUNUPEXIF grep -o ..<<<ANARASATAXAYBEBIBOBYJOKAKILIMIOIDOIDORPIQITIUSUTYEZA

• Saved 7 bytes thanks to Adam Katz comment

It uses sed to do regex replacement. First regex input is based on Sp3000 idea while second regex uses common input without spaces.

Explanation:

echo              print to standard output the following
U                 boundary U character
sed -r [etc]      the result of replacing regex
.             select a character
& &           replace it for: matched char, space, matched char
g             do it globaly for every character
<<<HAAB[etc]  string input based on Sp3000 idea => HA AA AB ...
F                 boundary F character
sed -r [etc]      the result of replacing regex
..            every two characters
<space>&      for space+matched character
g             do it globally
<<<ANAR       normal input => AN AR ...

• You can shrink that by seven bytes using a space and then grep -o .. in place of sed -r 's/ / &/g', a trick from my answer below. – Adam Katz Jan 23 '17 at 19:28

# C - 228 217 Bytes - GCC

 _;main(){char *z,*i="AABDEGHILMNRSTWXY AEIOY  EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU DEFHIMNPRSWXY AEI I E HIO AIO HMNPST  EOU IEO A A ";for(z=i;_++^26;)for(;*++z^32;putchar(_+64),putchar(*z),puts(""));}


Will update if I can get it smaller, just compile with gcc -w, ./a.out outputs perfectly. If there's any interest in an ungolfed, let me know.

I can't think of any way to shorten it off the top of my head, (you can technically remove the quotes in puts and you'll still get a correct answer, the output just looks like garbage) so please let me know of anyways to shorten it

• Here's a few suggestions, it runs fine for me (don't just copy and paste, stack exchange inserts weird control characters into comments)_;main(){char*z="AABDEGHILMNRSTWXY AEIOY EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU DEFHIMNPRSWXY AEI I E HIO AIO HMNPST EOU IEO A A ";for(;_++^26;)for(;*++z^32;printf("%c%c ",_+64,*z));} I've changed the output delimiter from a newline to a space, but if you prefer a newline (one extra byte) change the printf format string to "%c%c\n" – Level River St Aug 14 '15 at 19:30

# C#, 348 bytes

using System;class A{static void Main(){var a=new System.Collections.BitArray(Convert.FromBase64String("tnOciwgCCAAAAAggAFBxHIkAAAAACICIKABQQBgAAAIgIACAgCAAIqIgigCCADfWuIgAAAACAIAAAAAwCICAIAAAYRkAAAAAAggAgAAIIoAACA=="));int c, d;for(var i=0;i<652;i++){if(a[i]){c=Math.DivRem(i,26,out d);Console.Write("{0}{1} ",(char)('A' + c),(char)('@' + d));}}}}


Ungolfed:

using System;

class A
{
static void Main()
{
var a = new System.Collections.BitArray(Convert.FromBase64String(
"AAAAAwCICAIAAAYRkAAAAAAggAgAAIIoAACA=="));
int c, d;
for(var i = 0; i < 652; i++)
{
if(a[i])
{
c = Math.DivRem(i, 26, out d);
Console.Write("{0}{1} ", (char)('A' + c), (char)('@' + d));
}
}
}
}

• This is a codegolf challenge, so you should post your byte-count (length of your code). Also try to shorten it a bit, for instance by removing whitespace. – Jakube Aug 13 '15 at 13:56
• @Jakube, is that better? – Jodrell Aug 13 '15 at 16:21
• Yes, looks o.k. – Jakube Aug 13 '15 at 18:51

PHP: 211 209 204

You have to turn warnings off, otherwise one will print in regards to the implicit creation of $b for($a=65;$b<strlen($c="ABDEGHILMNRSTWXY!AEIOY!EO!DFHLMNRSTX!AE!O!AEIMO!DFNST!O!AI!AIO!AEIMOUY!AEOU!DEFHIMNPRSWXY!AEI!I!E!HIO!AIO!HMNPST!EO!IU!AEO!A");$b++)if($c[$b]!='!')echo chr($a).$c[$b].' ';else$a++;  Very fun. Early attempts were in the 250 range, but this is my slimmest yet. • Try this byte counter. Note that turning off whitespace counting is incorrect, since it also discounts any spaces you have in strings, so your score should be more than 186. – Sp3000 Aug 13 '15 at 15:15 • Good catch. I've updated my submission accordingly – NickW Aug 13 '15 at 15:23 • I can't see why.. but this now just prints "A A A A A..." – James Webster Aug 13 '15 at 15:28 • You've taken out the ! on the if.. you needed that. – James Webster Aug 13 '15 at 15:31 • Right. I just noticed that. I was using ! delimiter earlier and I did a quick find-replace without considering what would happen first. – NickW Aug 13 '15 at 15:34 ## CJam (99 bytes) This includes a few special characters, so it's safest to give a hexdump. (In particular, the character with value 0xa0, corresponding to a non-breaking space, caused me quite a bit of trouble in setting up the online demo). 00000000 36 37 36 22 c4 b2 2d 51 3f 04 93 5c 64 6c 8d 6e |676"..-Q?..\dl.n| 00000010 d7 f9 7d 97 29 aa 43 ef 04 41 12 e1 aa ce 12 4d |..}.).C..A.....M| 00000020 05 f3 1c 2b 73 43 a0 f0 41 c0 a7 33 24 06 37 a3 |...+sC..A..3$.7.|
00000030  83 96 57 69 9b 91 c4 09  c3 93 e1 ed 05 3b 84 55  |..Wi.........;.U|
00000040  d9 26 fd 47 68 22 32 35  36 62 33 38 62 7b 31 24  |.&.Gh"256b38b{1$| 00000050 2b 7d 2f 5d 7b 32 36 62 28 3b 36 35 66 2b 3a 63 |+}/]{26b(;65f+:c| 00000060 4e 7d 2f |N}/| 00000063  The approach is difference-encoding in base-26. • Adding a character to an integer yields a character, so you can replace 65f+:c with 'Af+. – Dennis Aug 13 '15 at 22:30 • True. And md is a brilliant improvement, but I hadn't realised how close my answer is to yours. – Peter Taylor Aug 14 '15 at 15:31 # CJam, 100 98 bytes 'A'@" ©Ô&ñ±ð¨9_AÚá¼thÁätÑû¨HÙH&J3p¼ÛèVçckùá%´}xà41"260bGb{_{+N2$2$}{;;)'@}?}%-3<  (permalink) • Saved two bytes via preinitialized variables (thanks Dennis!) This is my first CJam entry, so there is probably the potential for some more golfing. However, I came up with a way to compress the list of characters down to 63 bytes which, hopefully, someone else will find helpful. ## Compression Method So far most methods that I saw encoded both letters of each word. However, when we put the words in alphabetical order, the first letter doesn't change very often, so it seems wasteful to encode it explicitly. I encode only the last character of each word, and include a special item whenever the first character should increment. The characters are encoded as the first character, then a list of differences. Since there are no duplicate words, the differences must all be at least 1. Thus I can use 0 as a separator item. (Note that I must then store the first letter of each subsequence as one-indexed, otherwise there would be confusion between 'rollover first character 0' and 'start with A 0'.) Since the differences in this case are never greater than 15, we can use base-16 and pack two (4-bit) items into each (8-bit) byte. (In the actual code I converted from base-260 instead of base-256 to avoid issues with unprintable characters.) • You can save a couple of bytes by using G and N, which push 16 and a linefeed. – Dennis Aug 16 '15 at 0:21 • @Dennis Thanks, didn't realize variables were preinitialized! – 2012rcampion Aug 16 '15 at 0:27 • All 26 uppercase letters are preinitialized variables. You can see the complete list here. – Dennis Aug 16 '15 at 0:30 • You can save more bytes by replacing %-3< with /;; or even /&. (The second option will generate an error message. Consensus on meta is that it's OK to do this.) – Dennis Aug 16 '15 at 5:00 # Python 3, 224 bytes s='';i=int("AQHU9HU1X0313T1J9OMYMZZSRFWLCYT3POSE06UGHXDZN6H5SQSZIFCE6VEB",36) for c in range(26): b=i%6;i//=6;k=(1<<b)-1;j=i%(1<<k);i>>=k for d in 'AOIEHMUSTMNDFPYBCGJKLQRVWXZ': if j&1:s+=chr(c+65)+d+' ' j>>=1 print s  Uses bit masks of variable length to encode which second letters exist for each possible first letter. The bit masks can be 0,1,3,7,15 or 31 bits long. Bits are mapped to letters with for d in 'AOIEHMUSTMNDFPYBCGJKLQRVWXZ':, earlier bits are used for more common letters so that the bit masks can be short in most cases (usually 3 or 7 bits since most consonants are only followed by one of 5 vowels or Y M or H). Unfortunately the code to decode it negates the savings compared to more simple methods (the original list is only 303 bytes). • I discovered it's better to encode which first letter exists for each possible second letter in my solution. Might be worth trying in yours. – James Webster Aug 13 '15 at 15:08 # Haskell, 192 bytes putStr$(\(a:b)->((a:).(:" "))=<<b)=<<words"AABDEGHILMNRSTWXY BAEIOY DEO EDFHLMNRSTX FAE GO HAEIMO IDFNST JO KAI LAIO MAEIMOUY NAEOU ODEFHIMNPRSWXY PAEI QI RE SHIO TAIO UHMNPST WEO XIU YAEO ZA"


For every space separated word in the string put the first letter in front of all other letters and add a space, e.g SHIO -> SH SI SO.

## Java, 334 bytes

public class C{public static void main(String[]a){for(int i=0;i<26;i++){for(int j=0;j<26;j++){if(java.util.BitSet.valueOf(java.util.Base64.getDecoder().decode("2znORQQBBAAAAAQQAKg4jkQAAAAABEBEFAAoIAwAAAEQEABAQBAAEVEQRQBBgBtrXEQAAAABAEAAAAAYBEBAEACAsAwAAAAAAQQAQAAEEUAABA==")).get(i*26+j)){System.out.format("%c%c\n",'a'+i,'a'+j);}}}}}


Formatted:

public class Code {
public static void main(String[] a) {
for (int i = 0; i < 26; i++) {
for (int j = 0; j < 26; j++) {
if (java.util.BitSet.valueOf(
java.util.Base64.getDecoder()
.decode("2znORQQBBAAAAAQQAKg4jkQAAAAABEBEFAAoIAwAAAEQEABAQBAAEVEQRQBBgBtrXEQAAAABAEAAAAAYBEBAEACAsAwAAAAAAQQAQAAEEUAABA=="))
.get(i * 26 + j)) {
System.out.format("%c%c\n", 'a' + i, 'a' + j);
}
}
}
}
}


Separately, I encoded the word list into a length 26x26=676 BitSet, converted it to a byte array, and then finally to Base 64. That string is hard-coded in this program, and the reverse procedure is used to reproduce the BitSet, and ultimately print out the list of words

## Java, 356 bytes

Uses the random number generator to get the words:

import java.util.Random;class X{public static void main(String[]a){int j,n,m=9,x;for(String u:"rgzza 2u2hh r2rxs qs5f fwiag 26i33y 2xqmje 5h94v 16ld2a 17buv 4zvdi 1elb3y 2t108q 5wne9 1mrbfe 1ih89 fh9ts r0gh".split(" ")){x=Integer.parseInt(u,36);Random r=new Random(x/2);j=m-=x%2;while(j-->0){n=r.nextInt(676);System.out.format(" %c%c",65+n/26,65+n%26);}}}}


Ungolfed:

import java.util.Random;
class X{
public static void main(String[]a){
int j,n,m=9,x;
for(String u:"rgzza 2u2hh r2rxs qs5f fwiag 26i33y 2xqmje 5h94v 16ld2a 17buv 4zvdi 1elb3y 2t108q 5wne9 1mrbfe 1ih89 fh9ts r0gh".split(" ")){
x=Integer.parseInt(u,36);
Random r=new Random(x/2);
j=m-=x%2;
while(j-->0){
n=r.nextInt(676);
System.out.format(" %c%c",65+n/26,65+n%26);
}
}
}
}


You can try it here: http://ideone.com/Qni32q

## Perl, 248 bytes

@v=split(//,"AEIOU");@s=split(' ',"ADEGIRSWX LSTX DFN EFIPRX HPST BHLMNTY DFHMNR ST DHMNSWY MN ZFKP WYPB KQXLHPMB LGJTB X");for(0..14){foreach $c(split(//,@s[$_])){$_<10?print @v[$_%5].$c." ":a;$_>4?print $c.@v[$_%5]." ":a;}}print "MM MY BY HM SH";


First time using perl (and first time golfing), so there's definitely room for improvement. Factored out the vowels and grouped the remaining letters based on how the resulting word was created - adding the vowel first, last, or both vowel first and last create a word on the list.

• I don't know Perl, but I assume you are separating the output by spaces. It seems "MM "."MY "."BY "."HM "."SH " could be shortened to "MM MY BY HM SH". – Level River St Aug 14 '15 at 19:05
• @steveverrill Thanks! I got so caught up in the rest of the code that I overlooked how redundant that was. – VoiceOfFolly Aug 14 '15 at 19:18

# Java, 255 254 bytes

Found a way to squeeze one more byte out of it.

class C{public static void main(String[]a){char c='A';for(char l:"ABDEGHILMNRSTWXY AEIOY  EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU DEFHIMNPRSWXY AEI I E HIO AIO HMNPST  EO IU AEO A".toCharArray())if(l<'A')c++;else System.out.print(" "+c+l);}}


Or (though not much clearer):

class C {
public static void main(String[] a) {
char c = 'A';
for (char l : "ABDEGHILMNRSTWXY AEIOY  EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU DEFHIMNPRSWXY AEI I E HIO AIO HMNPST  EO IU AEO A"
.toCharArray())
if (l < 'A')
c++;
else
System.out.print(" " + c + l);
}
}

• You can save two bytes by changing both occurrences of 'A' into 65. – ProgramFOX Aug 15 '15 at 12:31

Just for fun!

Evaluating s will print all of the words in a weird order - I used the fact that most combinations are vowel-consonant or vice versa, could probably optimize even more with custom character "classes", shortening the encoded matrix (here, w and k).

Does anybody know a shorter way to print strings without quotes and brackets than my monadic one? Type classes are even longer as far as I can tell.

Also, there might also be a shorter way of doing p's job...

v="AEIOU"
c="BCDFGHJKLMNPQRSTVWXYZ"
w=[976693,321324,50188,945708,52768]
k=[15,0,10,3,8,15,8,5,13,31,27,7,4,2,12,13,0,10,20,11,1]
z a b x=[[c:[e]|(e,f)<-b#p d,f]|(c,d)<-a#x]
(#)=zip
p 0=[]
p n=((nmod2)>0):p(ndiv2)
s=mapM_ putStrLn$concat$z v c w++z c v k++[words"AA AE AI BY HM MM MY OE OI SH"]

• Isn't sequence_ the same as void$sequence? Then you can omit also the import. – nimi Aug 13 '15 at 22:40 • That's oddly packaged, but yes. Thanks! – Leif Willerts Aug 13 '15 at 22:48 • Isn't, void had to be imported. Anyways, gonna/gotta remember this. – Leif Willerts Aug 13 '15 at 22:52 • Ah, and sequence_$map putStrLn is mapM_ putStrLn. Replace the (, ) around concat$... with another $. – nimi Aug 13 '15 at 23:07

# F#, 205 bytes

Seq.iteri(fun i s->Seq.iter(printf"%c%c "((char)i+'A'))s;printfn"")("ABDEGHILMNRSTWXY AEIOY  EO DFHLMNRSTX AE O AEIMO DFNST O AI AIO AEIMOUY AEOU DEFHIMNPRSWXY AEI I E HIO AIO HMNPST  EO IU AEO A".Split())


# Javascript (ES6), 214

Perhaps not the shortest way to do it, but definitely interesting.

_=>(i=0,[...'ABDEFGHILMNOPRSTUWXY'].map(z=>[...ABFHKLMNPTYZ
A
AEIO
ABDFHMNOPRWY
EIO
A
AEOSU
ABHKLMOPQSTX
AE
AEHMOU
AEIOU
BDGHJLMNSTWY
OU
AEO
AEIOU
AEIU
MNX
AO
AEO
ABMO.split
[i++]].map(g=>g+z).join ).join
)


Loops through each letter in the first string, adding it onto each letter in the corresponding line of the second. This returns the words in order of their last letter, like so:

AA BA FA HA KA LA MA NA PA TA YA ZA
AB
AE BE DE FE HE ME NE OE PE RE WE YE
EF IF OF
AG
AH EH OH SH UH
AI BI HI KI LI MI OI PI QI SI TI XI
AL EL
AM EM HM MM OM UM
AN EN IN ON UN
BO DO GO HO JO LO MO NO SO TO WO YO
OP UP
AR ER OR
AS ES IS OS US
AT ET IT UT
MU NU XU
AW OW
AX EX OX
AY BY MY OY


Suggestions welcome!

scala, 223 bytes

print(("AABDEGHILMNRSTWXY BAEIOY DEO EDFHLMNRSTX FAE GO HAEIMO IDFNST JO KAI LAIO MAEIMOUY NAEOU ODEFHIMNPRSWXY PAEI QI RE SHIO TAIO UHMNPST WEO XIU YAEO ZA".split(" ").flatMap(a=>a.tail.map(a(0).toString+_))).mkString(" "))


Not especially compact, but vaguely idiomatic .. eval with

scala -e '...'


# Java, 288

class E{public static void main(String[]a){a="ABDEGHILMNRSTWXY,AEIOY,,EO,DFHLMNRSTX,AE,O,AEIMO,DFNST,O,AI,AIO,AEIMOUY,AEOU,DEFHIMNPRSWXY,AEI,I,E,HIO,AIO,HMNPST,,EO,IU,AEO,A".split(",");for(int i=26,j;i-->0;)for(j=0;j<a[i].length();)System.out.println((char)('A'+i)+""+a[i].charAt(j++));}}


By just stringing together the second letters of each word (plus a delimiter), you just loop through while keeping track of the first. Not as fancy as the base-encoded versions, but much simpler and a good score for Java. Prints in order by descending-first-letter (ZA YA YE YO XI XU), one word per line.

With line breaks:

class E{
public static void main(String[]a){
a="ABDEGHILMNRSTWXY,AEIOY,,EO,DFHLMNRSTX,AE,O,AEIMO,DFNST,O,AI,AIO,AEIMOUY,AEOU,DEFHIMNPRSWXY,AEI,I,E,HIO,AIO,HMNPST,,EO,IU,AEO,A".split(",");
for(int i=26,j;i-->0;)
for(j=0;j<a[i].length();)
System.out.println((char)('A'+i)+""+a[i].charAt(j++));
}
}


# Python 239 bytes

import re;f=lambdax:''.join(re.findall('..',x));a,b='ABAHALAMANATAYDEDOEFEHEMENERHOISITMOMUNONUOSOWOY','AAADAEAGAIARASAWAXBEBIBOBYELESETEXFAGOHIHMIDIFINJOKAKILILOMIMMMYOEOFOIOPOROXPAPEPIQISHTOUHUPUSUTWEXIXUYEZA';print f(a),f(a[::-1]),f(b)


This is a bit long, but I've given it a try. I've counted all the patterns that also have the reversed counterparts. Ex) 'AB'/'BA' and so on.

# 05AB1E, 143 bytes (Non-compete)

•ZÐFý8ù6„=4ÅœÿWì±7Ë5Œ¾ó/îAnµ%Ñ¥Ëø±/ÀéNzÖ„Ñ§IJ¶D—ÙVEStvÖò…¸¾6F³#EXŠm¯CÄµ±ÓoÊ°}^€Ftåß€ðŒ=«j;F-Â1;xX3i&QZÒ'Ü”>lwìlOs>íÙVÇI)~î‰Hç²?Öd0È^ÝQ°•36B2ô»


Try it online!

## Python 3, 248 bytes

e=enumerate
[print(*(chr(x+65)+chr(j+65)+" "for j,i in e(bin(k)[2:])if int(i)))for x,k in e([30292443,16793873,0,16400,9320616,17,16384,20753,794664,16384,257,16641,17846545,1064977,29798840,273,256,16,16768,16641, 831616,0,16400,1048832,16401,1])]


The numbers were generated by an additional script
I'm sure that it can be optimized further

# PHP, 170 bytes

shortest approach I could find so far ...

for(;$c=ABFHKLMNPTYZ1A2AEIO1ABDFHMNOPRWY1EIO1A1AEOSU1ABHKJMOPQSTX3AE1AEHMOU1AEIOU1BDGHJLMNSTWY1OU11AEO1AEIOU1AEIU1MNX2AO1AEO1ABMO[$i++];)$c<1?print$c.chr($k+65)._:$k+=$c;  breakdown for(;$c=CHARACTERS[$i++];) // loop$c through map
$c<1 // if$c is a letter (integer value < 1)
?print$c.chr($k+65)._           // print first letter, second letter, delimiter
:$k+=$c                         // else increase second letter
;


Note The shortest bit-mapping version with printable ascii costs 190 bytes (113 bytes data+77 bytes decoding) using 6 bits=base 64, 174 bytes (97 data, 77 decoding) using 7 bits (base 128); possibly some more for escaping.

for(;$p<676;) // loop through combinations ord("MAPPING"[$p/6])-32>>$p%6&1 // test bit ? // if set, do nothing :print chr($p/26+65).chr(\$p++%26+65)._; // if not, print combination+delimiter


Base 224 (using ascii 32..255) takes 87 bytes data (+ escaping); but I guess the decoding will cost more than 10 bytes extra.
Excluding C and V from the map would save 16/14/13 bytes on the data but cost a lot in decoding.