2
\$\begingroup\$

Find the combination of N number of letters that make up the most words of length N.

For example:

n r u  ->  run, urn
dstu -> dust, stud
(these are just examples, not the best combination of 3,4 length sets of letters)

The challenge in the case is to start with length N=3 and end at N=11. Which combination of letters gives you the most words and what are those words?

For the contest, please use this word list. It contains 71,193 words. Please also let us know the time (in seconds) and CPU type/speed that you are using.

\$\endgroup\$
2
  • \$\begingroup\$ How do you score the results? Your question seems to imply that execution time is important, but is is more important than code size? \$\endgroup\$
    – Mr Lister
    Commented May 8, 2013 at 10:24
  • \$\begingroup\$ Code size is most imporatnt, time is just a curiosity. \$\endgroup\$
    – jftuga
    Commented May 13, 2013 at 17:27

7 Answers 7

4
\$\begingroup\$

Ruby, 116 97 92 characters

9.times{|n|p IO.read('w').split.group_by{|s|s.chars.sort}.max_by{|k,v|k.size!=n+3?0:v.size}}

The wordlist is expected in the file w in the local directory. Program runs less than a second.

Output:

[["A", "E", "T"], ["ATE", "EAT", "ETA", "TAE", "TEA"]]
[["A", "E", "L", "S"], ["ALES", "ELSA", "LEAS", "LESA", "SALE", "SEAL"]]
[["A", "E", "L", "S", "T"], ["LEAST", "SLATE", "STAEL", "STALE", "STEAL", "TALES", "TEALS", "TESLA"]]
[["A", "C", "E", "R", "S", "T"], ["CARETS", "CASTER", "CATERS", "CRATES", "REACTS", "RECAST", "TRACES"]]
[["A", "D", "E", "E", "G", "N", "R"], ["ANGERED", "DERANGE", "ENRAGED", "GRANDEE", "GRENADE"]]
[["A", "E", "G", "I", "L", "N", "R", "T"], ["ALERTING", "ALTERING", "INTEGRAL", "RELATING", "TRIANGLE"]]
[["A", "A", "C", "E", "I", "N", "R", "S", "T"], ["ASCERTAIN", "CARTESIAN", "SECTARIAN"]]
[["A", "D", "I", "I", "M", "N", "N", "O", "O", "T"], ["ADMONITION", "DOMINATION"]]
[["A", "C", "G", "H", "I", "I", "L", "M", "O", "R", "T"], ["ALGORITHMIC", "LOGARITHMIC"]]
\$\endgroup\$
8
  • 1
    \$\begingroup\$ Your solution does not return all correct results. For example, you only list {O,P,S,T} for four letters. {A,L,E,S} and {A,T,E,S} are also correct answers. \$\endgroup\$
    – DavidC
    Commented May 6, 2013 at 21:02
  • 2
    \$\begingroup\$ @DavidCarraher, the spec doesn't ask for more than one answer. It uses a singular noun more than once. \$\endgroup\$ Commented May 6, 2013 at 22:41
  • 1
    \$\begingroup\$ Your combinations contain repeated characters (are not sets). I can't see how a combination of a bag makes sense. \$\endgroup\$
    – Griffin
    Commented May 7, 2013 at 13:10
  • 1
    \$\begingroup\$ @Griffin, why not? Mathematical literature tends to be careful enough to say "combinations without repetitions" or "combinations with repetitions", but in this context it seems reasonable to understand "combinations with repetitions" (and all four current answers do). \$\endgroup\$ Commented May 7, 2013 at 13:32
  • \$\begingroup\$ How does one distinguish between {a,a} and {a,a} ? \$\endgroup\$
    – Griffin
    Commented May 7, 2013 at 14:02
2
\$\begingroup\$

k (39)

Expects the wordlist to be in a file called w in the current directory.

{i?max i:#:'=:{x@<x}'(w@=:#:'w:0:`:w)x}

Example usage (calculating result for every permissible input, runs in 640 ms on single core of Pentium E2160)

k){i?max i:#:'=:{x@<x}'(w@=:#:'w:0:`:w)x}'3+!9
("AET";"AELS";"AELST";"ACERST";"ADEEGNR";"AEGILNRT";"AACEINRST";"ADIIMNNOOT";..
\$\endgroup\$
2
\$\begingroup\$

Haskell, 341 chars

Takes the word list on standard input, and return all possible solutions for each 2 < n < 12 a quadruple of the form:

(n, s, l, w)

where

n = Selected number of letter (between 3 and 11)
s = Size of the biggest sets of words of given size
l = The ordered sets of letters that compose words
w = The sets of words for each set of letters

for example: (3,5,["AET"],[["ATE","EAT","ETA","TAE","TEA"]])

Compressed code

import Data.List;import Data.Function;main=do interact$unlines.map(show.(\x->(length.head.head$x,length.head$x,map(sort.head)$x,x)).last.groupBy((==)`on`length).sortBy(compare`on`length)).groupBy((==)`on`(length.head)).sortBy(compare`on`(length.head)).groupBy((==)`on`sort).sortBy(compare`on`sort).filter(\x->length x>=3&&length x<=11).lines

A bit more readable code

import Data.List
import Data.Function

main = do
    interact $ unlines . map ( show . (\x -> (length . head . head $ x, length . head $ x, map (sort . head) $ x, x)) . last . groupBy ((==) `on`length) . sortBy (compare `on` length)) . groupBy ((==) `on` (length . head)) . sortBy (compare `on ` (length . head)) . groupBy ((==) `on` sort) . sortBy (compare `on` sort) . filter (\x -> length x >= 3 && length x <= 11) . lines

Execution

Compiling with: ghc -O2 letter.hs
Running with: time ./letter < wordlist
Result: 1.75s user 0.03s system 99% cpu 1.784 total
CPU info: Intel i7 8x3.4 GHz 64 bits

Output

(3,5,["AET"],[["ATE","EAT","ETA","TAE","TEA"]])
(4,6,["AELS","AEST","OPST"],[["ALES","ELSA","LEAS","LESA","SALE","SEAL"],["ATES","EAST","EATS","SATE","SEAT","TEAS"],["OPTS","POST","POTS","SPOT","STOP","TOPS"]])
(5,8,["AELST"],[["LEAST","SLATE","STAEL","STALE","STEAL","TALES","TEALS","TESLA"]])
(6,7,["ACERST"],[["CARETS","CASTER","CATERS","CRATES","REACTS","RECAST","TRACES"]])
(7,5,["ACDEILM","ADEEGNR","ADEHRST","ADEIRST","AEIRSTT","AELPRSY","EIPRSST"],[["CLAIMED","DECIMAL","DECLAIM","MALICED","MEDICAL"],["ANGERED","DERANGE","ENRAGED","GRANDEE","GRENADE"],["DEARTHS","HARDEST","HATREDS","THREADS","TRASHED"],["ARIDEST","ASTRIDE","STAIDER","TARDIES","TIRADES"],["ARTIEST","ARTISTE","ATTIRES","IRATEST","TASTIER"],["PARLEYS","PARSLEY","PLAYERS","REPLAYS","SPARELY"],["PERSIST","PRIESTS","SPRIEST","SPRITES","STRIPES"]])
(8,5,["AEGILNRT","AEGINRST"],[["ALERTING","ALTERING","INTEGRAL","RELATING","TRIANGLE"],["ANGRIEST","GANTRIES","INGRATES","RANGIEST","TANGIERS"]])
(9,3,["AACEINRST","ABEEILRST","ACDEINOTU","ACEGINRRT","ACEINSSTT","ADEGGINNR","ADEGINRRW","AEEGNRSST","AEGHILNRT","AEGIMNRST","AEILMSTTU","CEINORSTU","DEEINRSST","EGIILNNST","EGIINPRRS","EGINORRST"],[["ASCERTAIN","CARTESIAN","SECTARIAN"],["BEASTLIER","BLEARIEST","LIBERATES"],["AUCTIONED","CAUTIONED","EDUCATION"],["CRATERING","RETRACING","TERRACING"],["CATTINESS","SCANTIEST","TACITNESS"],["DANGERING","DERANGING","GARDENING"],["REDRAWING","REWARDING","WARDERING"],["ESTRANGES","GREATNESS","SERGEANTS"],["EARTHLING","HALTERING","LATHERING"],["EMIGRANTS","MASTERING","STREAMING"],["MUTILATES","STIMULATE","ULTIMATES"],["COUNTRIES","CRETINOUS","NEUROTICS"],["DISSENTER","RESIDENTS","TIREDNESS"],["ENLISTING","LISTENING","TINSELING"],["REPRISING","RESPIRING","SPRINGIER"],["RESORTING","RESTORING","ROSTERING"]])
(10,2,["AAAILNRSTU","AABEIILNST","AACDEGLOTU","AACEGLOSTU","AACEINRSST","AAEILNORST","AAEINOPRRT","AAGILLMNRY","AAGINNOSTT","ABDDEIORSS","ACCEHIMSST","ACDEEILNRT","ACDEGIIMNT","ACDEIIMNOT","ACDEIIPRST","ACDEINOORT","ACEEILMSST","ACEEINNRST","ACEEINRSST","ACEGHINRTT","ACEIINOTTX","ACEILNOSST","ACGIINNOTU","ACGILLNOPS","ADEEGINNRS","ADEEHILPRS","ADEEIMNNOT","ADEEINRSTT","ADEEINRSTU","ADEFORRSTW","ADEGIILMNS","ADEILPSTTU","ADEINNOOTT","ADIIMNNOOT","AEEGIMNPRT","AEEGINNRST","AEEGINNRTV","AEEHILRSTT","AEEHINRSST","AEEHORSSUW","AEEINNORTV","AEEIPRSSTT","AEEMNSSTTT","AEGHILNRST","AEGHINRSTT","AEGIINNPRT","AEGINRRSTT","AEHIRSSTTW","AEIILORSST","AFIILNORTT","AGHILMORST","AGIILMNTTU","AIILNOOPST","BDEGILNORU","BEGILNORST","CCEEGHIKNR","CCEEGINORT","CCEGINNORT","CDDEINOSTU","CDEEIINRST","CDEEIORRSV","CDEEMOPRSS","CDEEOPRRSU","CDEGIINNRS","CDEIINORST","CDEIINRSTT","CDEINORSTU","CEFGIINRTY","CEFGINORSU","CEGHIIKNNT","CEGINNNOTT","CEGINNORSV","CEGINNORTU","CEIINNOPST","CEINOPRSSU","DEEEINNRTV","DEEEIPRSTX","DEEELOPRSV","DEEFIILNRS","DEEFORRSST","DEEIMNORSZ","DEGILNOSTU","DEGINNRSSU","DEIINOOPST","EEGINNPRST","EEGLNORSTT","EEIIMPRSSV","EEIINOPRTT","EEINPRSSTT","EELOPRSSTY","EFIMNORSTU","EGIINPRSST","EGILMNOOSS","EIIMNOPRSS","EIMNNRSTTU","EIMNOPRSTU","GHILOPSSTT"],[["AUSTRALIAN","SATURNALIA"],["BANALITIES","INSATIABLE"],["CATALOGUED","COAGULATED"],["CATALOGUES","COAGULATES"],["ASCERTAINS","SECTARIANS"],["RATIONALES","SENATORIAL"],["PRAETORIAN","REPARATION"],["ALARMINGLY","MARGINALLY"],["ANTAGONIST","STAGNATION"],["BROADSIDES","SIDEBOARDS"],["CATECHISMS","SCHEMATICS"],["CREDENTIAL","INTERLACED"],["DECIMATING","MEDICATING"],["DECIMATION","MEDICATION"],["PATRICIDES","PEDIATRICS"],["COORDINATE","DECORATION"],["CLEMATISES","TIMESCALES"],["NECTARINES","TRANSIENCE"],["ANCESTRIES","RESISTANCE"],["CHATTERING","RATCHETING"],["EXCITATION","INTOXICATE"],["COASTLINES","SECTIONALS"],["AUCTIONING","CAUTIONING"],["COLLAPSING","SCALLOPING"],["GRENADINES","SERENADING"],["DEALERSHIP","LEADERSHIP"],["DENOMINATE","EMENDATION"],["REINSTATED","STRAITENED"],["UNREADIEST","UNSTEADIER"],["AFTERWORDS","FORWARDEST"],["MISDEALING","MISLEADING"],["PLATITUDES","STIPULATED"],["DENOTATION","DETONATION"],["ADMONITION","DOMINATION"],["IMPREGNATE","PERMEATING"],["ARGENTINES","TANGERINES"],["ENERVATING","VENERATING"],["EARTHLIEST","STEALTHIER"],["EARTHINESS","HEARTINESS"],["HOUSEWARES","WAREHOUSES"],["ENERVATION","VENERATION"],["STRIPTEASE","TAPESTRIES"],["STATEMENTS","TESTAMENTS"],["EARTHLINGS","SLATHERING"],["SHATTERING","STRAIGHTEN"],["PERTAINING","REPAINTING"],["REGISTRANT","RESTARTING"],["SWARTHIEST","SWEATSHIRT"],["SOLITAIRES","SOLITARIES"],["FILTRATION","FLIRTATION"],["ALGORITHMS","LOGARITHMS"],["MUTILATING","ULTIMATING"],["POSITIONAL","SPOLIATION"],["BOULDERING","REDOUBLING"],["BOLSTERING","LOBSTERING"],["CHECKERING","RECHECKING"],["EGOCENTRIC","GEOCENTRIC"],["CONCERTING","CONCRETING"],["DEDUCTIONS","DISCOUNTED"],["INDISCREET","IRIDESCENT"],["DISCOVERER","REDISCOVER"],["COMPRESSED","DECOMPRESS"],["PROCEDURES","REPRODUCES"],["DISCERNING","RESCINDING"],["DIRECTIONS","DISCRETION"],["DISTINCTER","INTERDICTS"],["INTRODUCES","REDUCTIONS"],["CERTIFYING","RECTIFYING"],["CONFIGURES","REFOCUSING"],["KITCHENING","THICKENING"],["CONTENTING","CONTINGENT"],["CONSERVING","CONVERSING"],["COUNTERING","RECOUNTING"],["INCEPTIONS","INSPECTION"],["PERCUSSION","SUPERSONIC"],["INTERVENED","REINVENTED"],["EXPEDITERS","PREEXISTED"],["DEVELOPERS","REDEVELOPS"],["FRIENDLIES","INFIELDERS"],["DEFROSTERS","FORTRESSED"],["MODERNIZES","SERMONIZED"],["LONGITUDES","UNGODLIEST"],["UNDERSIGNS","UNDRESSING"],["DEPOSITION","POSITIONED"],["PRESENTING","SERPENTING"],["LONGSTREET","LORGNETTES"],["IMPRESSIVE","PERMISSIVE"],["PETITIONER","REPETITION"],["PERSISTENT","PRETTINESS"],["POLYESTERS","PROSELYTES"],["MISFORTUNE","UNIFORMEST"],["PERSISTING","SPRINGIEST"],["GLOOMINESS","NEOLOGISMS"],["IMPRESSION","PERMISSION"],["INSTRUMENT","NUTRIMENTS"],["IMPORTUNES","RESUMPTION"],["SPOTLIGHTS","STOPLIGHTS"]])
(11,2,["AABCDEORRST","AACGGILNOTU","AACGHILLPRY","AAEIILNORTZ","AAEILMNPRST","ABCEEEILRSV","ABCEEFIILRT","ACDEEINORST","ACDEFIIINOT","ACDEINOORST","ACEEIIPPRTT","ACEINOOPRRT","ACGHIILMORT","ACIILLNOOST","ADEEILMNRST","ADEEIMNNOST","ADEIINOPRTT","ADEINNOOSTT","AEEIIMPRSTV","AEEILNTTTVY","AEEIMNNORTU","AEGHILNOOST","AEGIINNORTT","AEGIINNRSTT","AEIMNOPRTTU","CDEEEOPRRSS","CDEEIORRSSV","CDEIINNOORT","CDEIINOPRST","DEEFIIINNST","EEEINPRRSST","EEEIOPRRRST","EEGIINNNRTV","EEHLOPRRSTU","EEIINOPRSTT","EIIMNOPRSSS"],[["BROADCASTER","REBROADCAST"],["CATALOGUING","COAGULATING"],["CALLIGRAPHY","GRAPHICALLY"],["RATIONALIZE","REALIZATION"],["PARLIAMENTS","PATERNALISM"],["RECEIVABLES","SERVICEABLE"],["CERTIFIABLE","RECTIFIABLE"],["CONSIDERATE","DESECRATION"],["DEIFICATION","EDIFICATION"],["COORDINATES","DECORATIONS"],["PERIPATETIC","PRECIPITATE"],["INCORPORATE","PROCREATION"],["ALGORITHMIC","LOGARITHMIC"],["COLONIALIST","OSCILLATION"],["DERAILMENTS","STREAMLINED"],["DENOMINATES","EMENDATIONS"],["PARTITIONED","TREPIDATION"],["DENOTATIONS","DETONATIONS"],["IMPERATIVES","SEMIPRIVATE"],["ATTENTIVELY","TENTATIVELY"],["ENUMERATION","MOUNTAINEER"],["ANTHOLOGIES","THEOLOGIANS"],["INTEGRATION","ORIENTATING"],["REINSTATING","STRAITENING"],["IMPORTUNATE","PERMUTATION"],["PREDECESSOR","REPROCESSED"],["DISCOVERERS","REDISCOVERS"],["CONDITIONER","RECONDITION"],["DESCRIPTION","PREDICTIONS"],["INDEFINITES","INTENSIFIED"],["ENTERPRISES","INTERSPERSE"],["REPERTOIRES","REPERTORIES"],["INTERVENING","REINVENTING"],["REUPHOLSTER","UPHOLSTERER"],["PETITIONERS","REPETITIONS"],["IMPRESSIONS","PERMISSIONS"]])
\$\endgroup\$
1
\$\begingroup\$

Mathematica 192

A bit wordy, but it returns multiple correct answers for the same word length (when they exist):

w = Flatten[Characters@Import["words.txt", "Data"], 1];
Table[Cases[#, {x_, Max[#[[All, -1]]]} :> {Characters@x[[1]], x}] &[{StringJoin /@ #, 
Length[#]} & /@ GatherBy[Select[w, Length[#] == k &], Sort[#1] &]], {k, 3, 11}]

Timing: 1.228453 s; 2.8 GHz Intel i7 Mac OS X 10.8.3

Results for lengths 3-9 are displayed below. There are too many winning combinations for sets of 10, 11 letters to be displayed here.

winners

\$\endgroup\$
1
\$\begingroup\$

GolfScript (53 chars)

n/{[.$\]}%$'']({.1<2$<{1>+}*}/]9,{3+\{(,2$=*,}$)p}/];

or

n/{[.$\]}%$'']({.1<2$<{1>+}*}/]3{\{(,2$=*,}$)p\)}9*;;

I assume that there is at least one word of each length in the range processed: otherwise things will go badly wrong.

["AET" "ATE" "EAT" "ETA" "TAE" "TEA"]
["AELS" "ALES" "ELSA" "LEAS" "LESA" "SALE" "SEAL"]
["AELST" "LEAST" "SLATE" "STAEL" "STALE" "STEAL" "TALES" "TEALS" "TESLA"]
["ACERST" "CARETS" "CASTER" "CATERS" "CRATES" "REACTS" "RECAST" "TRACES"]
["ADEEGNR" "ANGERED" "DERANGE" "ENRAGED" "GRANDEE" "GRENADE"]
["AEGINRST" "ANGRIEST" "GANTRIES" "INGRATES" "RANGIEST" "TANGIERS"]
["AACEINRST" "ASCERTAIN" "CARTESIAN" "SECTARIAN"]
["EEINPRSSTT" "PERSISTENT" "PRETTINESS"]
["EEIINOPRSTT" "PETITIONERS" "REPETITIONS"]

Took about 2 minutes on my 2GHz 64-bit CPU.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The present answer fails to list all solutions. \$\endgroup\$
    – DavidC
    Commented May 6, 2013 at 22:59
  • \$\begingroup\$ @DavidCarraher, see my previous answer to this comment. \$\endgroup\$ Commented May 7, 2013 at 7:18
0
\$\begingroup\$

J (96)

(echo@(((~.#~([=>./)@(#/.~))="0/[)@:((/:{[)&.>)#[)@((LF cut 1!:1[3)&([#~]=>@(#&.>)@[)))&.>3+i.9

It runs in a few seconds on my 2Ghz Pentium 4. It expects the wordlist on stdin, i.e. cat wordlist | jconsole combinations.ijs

Output:

┌───┬───┬───┬───┬───┐
│ATE│EAT│ETA│TAE│TEA│
└───┴───┴───┴───┴───┘
┌────┬────┬────┬────┬────┬────┐
│ALES│ELSA│LEAS│LESA│SALE│SEAL│
├────┼────┼────┼────┼────┼────┤
│ATES│EAST│EATS│SATE│SEAT│TEAS│
├────┼────┼────┼────┼────┼────┤
│OPTS│POST│POTS│SPOT│STOP│TOPS│
└────┴────┴────┴────┴────┴────┘
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│LEAST│SLATE│STAEL│STALE│STEAL│TALES│TEALS│TESLA│
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐
│CARETS│CASTER│CATERS│CRATES│REACTS│RECAST│TRACES│
└──────┴──────┴──────┴──────┴──────┴──────┴──────┘
┌───────┬───────┬───────┬───────┬───────┐
│ANGERED│DERANGE│ENRAGED│GRANDEE│GRENADE│
├───────┼───────┼───────┼───────┼───────┤
│ARIDEST│ASTRIDE│STAIDER│TARDIES│TIRADES│
├───────┼───────┼───────┼───────┼───────┤
│ARTIEST│ARTISTE│ATTIRES│IRATEST│TASTIER│
├───────┼───────┼───────┼───────┼───────┤
│CLAIMED│DECIMAL│DECLAIM│MALICED│MEDICAL│
├───────┼───────┼───────┼───────┼───────┤
│DEARTHS│HARDEST│HATREDS│THREADS│TRASHED│
├───────┼───────┼───────┼───────┼───────┤
│PARLEYS│PARSLEY│PLAYERS│REPLAYS│SPARELY│
├───────┼───────┼───────┼───────┼───────┤
│PERSIST│PRIESTS│SPRIEST│SPRITES│STRIPES│
└───────┴───────┴───────┴───────┴───────┘
┌────────┬────────┬────────┬────────┬────────┐
│ALERTING│ALTERING│INTEGRAL│RELATING│TRIANGLE│
├────────┼────────┼────────┼────────┼────────┤
│ANGRIEST│GANTRIES│INGRATES│RANGIEST│TANGIERS│
└────────┴────────┴────────┴────────┴────────┘
┌─────────┬─────────┬─────────┐
│ASCERTAIN│CARTESIAN│SECTARIAN│
├─────────┼─────────┼─────────┤
│AUCTIONED│CAUTIONED│EDUCATION│
├─────────┼─────────┼─────────┤
│BEASTLIER│BLEARIEST│LIBERATES│
├─────────┼─────────┼─────────┤
│CATTINESS│SCANTIEST│TACITNESS│
├─────────┼─────────┼─────────┤
│COUNTRIES│CRETINOUS│NEUROTICS│
├─────────┼─────────┼─────────┤
│CRATERING│RETRACING│TERRACING│
├─────────┼─────────┼─────────┤
│DANGERING│DERANGING│GARDENING│
├─────────┼─────────┼─────────┤
│DISSENTER│RESIDENTS│TIREDNESS│
├─────────┼─────────┼─────────┤
│EARTHLING│HALTERING│LATHERING│
├─────────┼─────────┼─────────┤
│EMIGRANTS│MASTERING│STREAMING│
├─────────┼─────────┼─────────┤
│ENLISTING│LISTENING│TINSELING│
├─────────┼─────────┼─────────┤
│ESTRANGES│GREATNESS│SERGEANTS│
├─────────┼─────────┼─────────┤
│MUTILATES│STIMULATE│ULTIMATES│
├─────────┼─────────┼─────────┤
│REDRAWING│REWARDING│WARDERING│
├─────────┼─────────┼─────────┤
│REPRISING│RESPIRING│SPRINGIER│
├─────────┼─────────┼─────────┤
│RESORTING│RESTORING│ROSTERING│
└─────────┴─────────┴─────────┘
┌──────────┬──────────┐
│ADMONITION│DOMINATION│
├──────────┼──────────┤
│AFTERWORDS│FORWARDEST│
├──────────┼──────────┤
│ALARMINGLY│MARGINALLY│
├──────────┼──────────┤
│ALGORITHMS│LOGARITHMS│
├──────────┼──────────┤
│ANCESTRIES│RESISTANCE│
├──────────┼──────────┤
│ANTAGONIST│STAGNATION│
├──────────┼──────────┤
│ARGENTINES│TANGERINES│
├──────────┼──────────┤
│ASCERTAINS│SECTARIANS│
├──────────┼──────────┤
│AUCTIONING│CAUTIONING│
├──────────┼──────────┤
│AUSTRALIAN│SATURNALIA│
├──────────┼──────────┤
│BANALITIES│INSATIABLE│
├──────────┼──────────┤
│BOLSTERING│LOBSTERING│
├──────────┼──────────┤
│BOULDERING│REDOUBLING│
├──────────┼──────────┤
│BROADSIDES│SIDEBOARDS│
├──────────┼──────────┤
│CATALOGUED│COAGULATED│
├──────────┼──────────┤
│CATALOGUES│COAGULATES│
├──────────┼──────────┤
│CATECHISMS│SCHEMATICS│
├──────────┼──────────┤
│CERTIFYING│RECTIFYING│
├──────────┼──────────┤
│CHATTERING│RATCHETING│
├──────────┼──────────┤
│CHECKERING│RECHECKING│
├──────────┼──────────┤
│CLEMATISES│TIMESCALES│
├──────────┼──────────┤
│COASTLINES│SECTIONALS│
├──────────┼──────────┤
│COLLAPSING│SCALLOPING│
├──────────┼──────────┤
│COMPRESSED│DECOMPRESS│
├──────────┼──────────┤
│CONCERTING│CONCRETING│
├──────────┼──────────┤
│CONFIGURES│REFOCUSING│
├──────────┼──────────┤
│CONSERVING│CONVERSING│
├──────────┼──────────┤
│CONTENTING│CONTINGENT│
├──────────┼──────────┤
│COORDINATE│DECORATION│
├──────────┼──────────┤
│COUNTERING│RECOUNTING│
├──────────┼──────────┤
│CREDENTIAL│INTERLACED│
├──────────┼──────────┤
│DEALERSHIP│LEADERSHIP│
├──────────┼──────────┤
│DECIMATING│MEDICATING│
├──────────┼──────────┤
│DECIMATION│MEDICATION│
├──────────┼──────────┤
│DEDUCTIONS│DISCOUNTED│
├──────────┼──────────┤
│DEFROSTERS│FORTRESSED│
├──────────┼──────────┤
│DENOMINATE│EMENDATION│
├──────────┼──────────┤
│DENOTATION│DETONATION│
├──────────┼──────────┤
│DEPOSITION│POSITIONED│
├──────────┼──────────┤
│DEVELOPERS│REDEVELOPS│
├──────────┼──────────┤
│DIRECTIONS│DISCRETION│
├──────────┼──────────┤
│DISCERNING│RESCINDING│
├──────────┼──────────┤
│DISCOVERER│REDISCOVER│
├──────────┼──────────┤
│DISTINCTER│INTERDICTS│
├──────────┼──────────┤
│EARTHINESS│HEARTINESS│
├──────────┼──────────┤
│EARTHLIEST│STEALTHIER│
├──────────┼──────────┤
│EARTHLINGS│SLATHERING│
├──────────┼──────────┤
│EGOCENTRIC│GEOCENTRIC│
├──────────┼──────────┤
│ENERVATING│VENERATING│
├──────────┼──────────┤
│ENERVATION│VENERATION│
├──────────┼──────────┤
│EXCITATION│INTOXICATE│
├──────────┼──────────┤
│EXPEDITERS│PREEXISTED│
├──────────┼──────────┤
│FILTRATION│FLIRTATION│
├──────────┼──────────┤
│FRIENDLIES│INFIELDERS│
├──────────┼──────────┤
│GLOOMINESS│NEOLOGISMS│
├──────────┼──────────┤
│GRENADINES│SERENADING│
├──────────┼──────────┤
│HOUSEWARES│WAREHOUSES│
├──────────┼──────────┤
│IMPORTUNES│RESUMPTION│
├──────────┼──────────┤
│IMPREGNATE│PERMEATING│
├──────────┼──────────┤
│IMPRESSION│PERMISSION│
├──────────┼──────────┤
│IMPRESSIVE│PERMISSIVE│
├──────────┼──────────┤
│INCEPTIONS│INSPECTION│
├──────────┼──────────┤
│INDISCREET│IRIDESCENT│
├──────────┼──────────┤
│INSTRUMENT│NUTRIMENTS│
├──────────┼──────────┤
│INTERVENED│REINVENTED│
├──────────┼──────────┤
│INTRODUCES│REDUCTIONS│
├──────────┼──────────┤
│KITCHENING│THICKENING│
├──────────┼──────────┤
│LONGITUDES│UNGODLIEST│
├──────────┼──────────┤
│LONGSTREET│LORGNETTES│
├──────────┼──────────┤
│MISDEALING│MISLEADING│
├──────────┼──────────┤
│MISFORTUNE│UNIFORMEST│
├──────────┼──────────┤
│MODERNIZES│SERMONIZED│
├──────────┼──────────┤
│MUTILATING│ULTIMATING│
├──────────┼──────────┤
│NECTARINES│TRANSIENCE│
├──────────┼──────────┤
│PATRICIDES│PEDIATRICS│
├──────────┼──────────┤
│PERCUSSION│SUPERSONIC│
├──────────┼──────────┤
│PERSISTENT│PRETTINESS│
├──────────┼──────────┤
│PERSISTING│SPRINGIEST│
├──────────┼──────────┤
│PERTAINING│REPAINTING│
├──────────┼──────────┤
│PETITIONER│REPETITION│
├──────────┼──────────┤
│PLATITUDES│STIPULATED│
├──────────┼──────────┤
│POLYESTERS│PROSELYTES│
├──────────┼──────────┤
│POSITIONAL│SPOLIATION│
├──────────┼──────────┤
│PRAETORIAN│REPARATION│
├──────────┼──────────┤
│PRESENTING│SERPENTING│
├──────────┼──────────┤
│PROCEDURES│REPRODUCES│
├──────────┼──────────┤
│RATIONALES│SENATORIAL│
├──────────┼──────────┤
│REGISTRANT│RESTARTING│
├──────────┼──────────┤
│REINSTATED│STRAITENED│
├──────────┼──────────┤
│SHATTERING│STRAIGHTEN│
├──────────┼──────────┤
│SOLITAIRES│SOLITARIES│
├──────────┼──────────┤
│SPOTLIGHTS│STOPLIGHTS│
├──────────┼──────────┤
│STATEMENTS│TESTAMENTS│
├──────────┼──────────┤
│STRIPTEASE│TAPESTRIES│
├──────────┼──────────┤
│SWARTHIEST│SWEATSHIRT│
├──────────┼──────────┤
│UNDERSIGNS│UNDRESSING│
├──────────┼──────────┤
│UNREADIEST│UNSTEADIER│
└──────────┴──────────┘
┌───────────┬───────────┐
│ALGORITHMIC│LOGARITHMIC│
├───────────┼───────────┤
│ANTHOLOGIES│THEOLOGIANS│
├───────────┼───────────┤
│ATTENTIVELY│TENTATIVELY│
├───────────┼───────────┤
│BROADCASTER│REBROADCAST│
├───────────┼───────────┤
│CALLIGRAPHY│GRAPHICALLY│
├───────────┼───────────┤
│CATALOGUING│COAGULATING│
├───────────┼───────────┤
│CERTIFIABLE│RECTIFIABLE│
├───────────┼───────────┤
│COLONIALIST│OSCILLATION│
├───────────┼───────────┤
│CONDITIONER│RECONDITION│
├───────────┼───────────┤
│CONSIDERATE│DESECRATION│
├───────────┼───────────┤
│COORDINATES│DECORATIONS│
├───────────┼───────────┤
│DEIFICATION│EDIFICATION│
├───────────┼───────────┤
│DENOMINATES│EMENDATIONS│
├───────────┼───────────┤
│DENOTATIONS│DETONATIONS│
├───────────┼───────────┤
│DERAILMENTS│STREAMLINED│
├───────────┼───────────┤
│DESCRIPTION│PREDICTIONS│
├───────────┼───────────┤
│DISCOVERERS│REDISCOVERS│
├───────────┼───────────┤
│ENTERPRISES│INTERSPERSE│
├───────────┼───────────┤
│ENUMERATION│MOUNTAINEER│
├───────────┼───────────┤
│IMPERATIVES│SEMIPRIVATE│
├───────────┼───────────┤
│IMPORTUNATE│PERMUTATION│
├───────────┼───────────┤
│IMPRESSIONS│PERMISSIONS│
├───────────┼───────────┤
│INCORPORATE│PROCREATION│
├───────────┼───────────┤
│INDEFINITES│INTENSIFIED│
├───────────┼───────────┤
│INTEGRATION│ORIENTATING│
├───────────┼───────────┤
│INTERVENING│REINVENTING│
├───────────┼───────────┤
│PARLIAMENTS│PATERNALISM│
├───────────┼───────────┤
│PARTITIONED│TREPIDATION│
├───────────┼───────────┤
│PERIPATETIC│PRECIPITATE│
├───────────┼───────────┤
│PETITIONERS│REPETITIONS│
├───────────┼───────────┤
│PREDECESSOR│REPROCESSED│
├───────────┼───────────┤
│RATIONALIZE│REALIZATION│
├───────────┼───────────┤
│RECEIVABLES│SERVICEABLE│
├───────────┼───────────┤
│REINSTATING│STRAITENING│
├───────────┼───────────┤
│REPERTOIRES│REPERTORIES│
├───────────┼───────────┤
│REUPHOLSTER│UPHOLSTERER│
└───────────┴───────────┘
\$\endgroup\$
0
\$\begingroup\$

APL (91)

{⎕ML←3⋄{⎕←⍵/S}¨↓⍉K∘.≡Z/⍨T=⌈/T←+⌿K∘.≡Z←∪K←{⍵[⍋⍵]}¨S←W/⍨⍵=↑∘⍴¨W←W⊂⍨~⎕TC∊⍨W←80 ¯1⎕MAP'w'}¨2+⍳9

Expects the word list to be in a file called w in the current directory. Takes about four minutes to run (but it was running in a virtual machine).

The default workspace size in Dyalog APL is 64kb, this is not enough so you need to increase it (I set it to a megabyte).

Explanation:

  • ⎕ML←3: to make work as partition
  • {...}¨2+⍳9: for [3..11]
  • W←W⊂⍨~⎕TC∊⍨W←80 ¯1⎕MAP'w': read the w file and split on terminal control characters (newlines and tab)
  • S←W/⍨⍵=↑∘⍴¨W: filter out the words of the current length
  • K←{⍵[⍋⍵]}¨S: sort the letters of each word
  • T←+⌿K∘.≡Z←∪K: for each unique bag of letters, see how many times it appears
  • Z/⍨T=⌈/T: select those groups of letters that occur as many times as the most occuring one
  • ↓⍉K∘.≡Z/⍨T: for each group of letters and each word, select those words that have the same letters
  • {⎕←⍵/S}: for each set of words, select those words from the non-sorted list and display them.
\$\endgroup\$

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.