Created
October 25, 2012 16:49
-
-
Save marksteve/3953975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python letterpress.py | |
5 vttplruohripniomtrptfaira | |
5 letters | |
votal volar vomit vitta vital virtu viron viral viola vinta vinal vapor valor varna varan vault vaunt truth trump troth trout trona troot troop tromp troft troat trior trifa trial trait trail train trant tramp trama tutor tutin tutti tulip turio turma tumor tufan tuath tuart tuarn tovar totum total topia tolan torta torii torma toral torah toran tourn tonal tooth tomin toman thruv thrum throu thrip thrap thram thulr thurt thurl thurm thump tholi thort thorp thorn thoro thoom thoft thirt thirl thiol thatn tharm tharf thana titar tipup tilth tirma tinta timor timon timar tiara tatou tatta tapul tapoa tapir tapia tappa talon talma talar talao tarot tarri tarin tarfa tarau taraf taupo taula taunt tahua tahil tahin taipo tairn taint tanti tanoa tanha tania tafia plump pluma plout ploat plait plain plant prunt proto proof proal prior prion print primp prima prana praam pupil pupal punto punti punta potto polio polar porto porta poral poult poulp pohna poilu point poppa popal ponto pooli pompa photo phono phial phano pivot pitau pilum pilot pilon pilin pilar pilau pirol piuri pipit pipal pinto pinta piano pavan pattu patta patio patao palpi palmo palma palar parto parol parma parao parah param paolo pahmi paint pappi papal panto lunar lotto lorum loran lohan loath livor litra litho lithi lipin linha limit liman liana latro latah lapon larva larin laura lauia lauan lanum lamin lamia rutin rupia rural rumor rumal ruana rotor rotal rotan routh rohun rohan roral rompu romal rhino rhamn rival ripup ripal rimpi rimal riata riant ravin ratti ratio ratal ralph raupo rauli ranal ramal uvito uviol uprip uppop uparm ultra ulnar ulmin urlar urial urnal urman urali urari uhlan uinal untop until untap untar unpot unlit unlap unrip unram unoil unhot unhit unhat unhap uniat unfit unfar unapt unarm unamo umiri ovant ottar opium oliva olona ortho orlop orant oulap ontal onium omlah omina hutia huron humor humin human holia horal houri honor hippo hilum hinau hiant halma haulm haunt haori haoma hanif hamal ilium ilima iliau irian ihram intil input inula inoma inial infra infit inapt inarm impot impar imino notum notal nopal north noria norma nival nitro niota niata naval navar natal napoo napal narra murva murra mural mufti motto motif motor mopla molar morth morph morin moron morat moral mouth mourn mount mohur mohar month monal mooth moorn mitra milpa milha mirth minot minor minar miaul matti matta matra matin matai mapau malar marli maria maral mahua mahar maint manto manta manul manor maniu mania manal mafoo flurr flurn fluor flump flota flora flout flour floor float flirt flint flimp flavo flair fruit frump froth front froom fritt frith friar frail fulth furor furil fural furan fotui folio folia forth forum fouth fount fohat filth filar filao firth final favor fatil fatal fault faham faith fairm faint fanal fanam avian avahi avail attar atrip atria atour athar atilt atman atavi apron aport apout apoop apiin apian apart alvar altun altho altin altar alpha aluta aloin aloof aloma aloft alima almon alarm alani alamo arval artha artal artar arupa aroon aroma aroar arhat arhar arrau arrah ariot arnut armor armil arati arain auloi aurir aurin aural aurar aumil aorta ahura ahunt ahint airan ainoi anvil antra antal anoli anoil animi anima ampul amula amort amour amhar amino amini amnia amain amani aflat afoul afoot afoam aalii | |
6 letters | |
voluta volupt volata volant vorpal vorant vomito vitium virial violin violon vihara vinata vimful vimana viator vatman vatful valuta truvat trumph truant trotol trophi tropal trivia tritor triton tripal trilit trinol trinal trauma tramal tutman tupman tupara turion turnip turmit totora totara topman torpor torula tornal tomtit tompon tomial tomorn tomato toatoa throat thrimp thrift thrail thrain thulir thulia tholoi thoria thoron thoral tivoli tithal titian titmal titman tittup titano tiptop tiponi tipiti tipman tipful tiltup tilpah tinful tavola tattva tattoo tapoun tapalo taluto talion talari tartro tartar tartan tarpum tarpot tarpon tarpan tarnal tarman taraph tautit taotai taipan tailor taihoa tantra tantum tampon tampin tampan tamanu plinth pliant platan plaint planta planar prutah proton prolan pronto pronpl prompt profit primal primar pratal pulton pulpit purlin puriri purana puntil puntal pottah potion potman potful potato portio portia portal poroma poplin poplar poppin pontil pontal pompon pompal pomato photon photal phoria phonal pituri pitpit pitpan pitman pilori pipiri pippin pimola pimplo pavior patrol patron patrin patria patola patina palpon palmar partan parlor paroli parrot parial pariah parian parpal paraph paramo paulin paular pailou papula papion papain panful panfil lutrin lotion loriot louvar lontar loofah lomita lithia lipoma limpin lavant latron latria lation larrup lariat laurin lantum lamina rupial rupiah rottan rotula roupit rohuna roomth rhinal ritual riprap rippon rippit rimula ratton rattan ratoon ration raptor ranula ramtil uvalha utopia utinam uptorn uptilt uploop uploom uplift uproot uproom uproar upprop uparna ultimo ultima urinal uramil untrim untipt untilt unplat unprop unprim unloop unlimp unlath unroot unroof unhoop unhair unhaft unital unmoor unmail unflat unform unfool unfilm unfirm unfair ovular ovinia ovarin oturia otiant option optant orthal orphan orihon ormolu orator outtop outpop outlip outrap outhit outman outfit oitava oilman oorali oarlop oarium oarial oarman hurroo huipil holour holmia horror hoopla homrai hiatal hatpin hatful hartin hartal harlot harmal harman hairup hairif hamfat iliahi irrupt ionium intuit intort intima inport inpour inlaut inhaul infula inform infilm infirm import impoor impofo impala impart imparl impair nutria notour normal nomial napalm narial mutton mutant mulita murlin muriti movant motion morvin mortal mortar morlop morula morion mouton moutan moulin mohair monial moorup mitral mirror matron matral matipo matapi maltha malati malapi martin marlin maroon marrot marron marina maholi mahout mahant mantra mantua mantal manual manuao manito manila manful mafura florin floran flioma flavor flavin flaunt flaith frivol fulham fulmar furoin funori fotmal folium foliot foliar fortin forpit forrit forint formin format formal fourth fontal fitout firlot firman fiorin finial fathom fatiha farina fautor faunal avital avaunt attrap attorn attain atrium atrial atrail atonia atonal athort atimon ataunt apolar aporia aponia applot apport apalit altoun alruna alroot alraun alumni alumna alarum alaihi artful arumin aroint arrant armpit armful automa author aurora aumail aortal aition ailuro airman ainhum aimful antlia antrum antral antiar anlaut anuria anotto anotta anotia anopia anorth anhima anilau anilao animal amrita amoral amount amhran amatol amarin afloat afront afaint | |
7 letters | |
volutin vitriol vitrail vitrain vitular vitamin virtual violina viminal valonia valiant variola variant vainful vamfont trophal trompil trivium trivial trivant tritolo tritium tritaph triplum tripoli tripart tripara trilith triunal triumph triform trifoil triarii travail tralira traitor trampot tramful ^CTraceback (most recent call last): | |
File "letterpress.py", line 15, in <module> | |
for p in itertools.permutations(letters, i): | |
KeyboardInterrupt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stderr as s | |
import itertools | |
with open("/usr/share/dict/words", "r") as f: | |
words = set([w.strip() for w in f.readlines()]) | |
start, letters = raw_input().split(' ') | |
start = int(start) | |
for i in range(start, 15): | |
print i, "letters" | |
found = set() | |
for p in itertools.permutations(letters, i): | |
p = ''.join(p) | |
if p in words and p not in found: | |
found.add(p) | |
s.write(p + " ") | |
s.flush() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment