I've written some code that provides answers to the daily NYT Spelling Bee puzzles which ask you to find words that can be constructed from 7 given letters, one of which must be present in each word:
allLetters = {"o", "p", "h", "e", "y", "n", "t"};centerLetter = "t";testWordChars = Table[Characters[WordList[][[n]]], {n, 1, Length[WordList[]]}];compWords = Table[Complement[testWordChars[[n]],allLetters], {n,1,Length[WordList[]]}];testWords = Table[If[compWords[[n]] == {}, True, False], {n, 1, Length[WordList[]]}];pos = Flatten[Position[testWords, True]];prelim = Flatten[Table[WordList[][[pos]], {n, 1}]];centerTest = Table[StringContainsQ[prelim[[n]],centerLetter], {n, 1,Length[prelim]}];pos2 = Flatten[Position[centerTest, True]];final = Flatten[Table[prelim[[pos2]], {n, 1}], 1];DeleteCases[final, _?(StringLength[#] < 4 &)]
This gives:{"entente", "eyetooth", "honeypot", "hoot","hotpot","neophyte","nett", "note", "onto","opponent", "pent", "petty", "peyote", "phenotype","photo", "photon", "poet", "pontoon", "poppet","potent", "potty", "python", "teen", "teeny", "teeth","teethe", "tenet", "tenon", "tent", "tenth", "tepee","thee", "then", "they","tone", "tonne", "toot", "tooth","toothy", "topee", "tote", "type","typhoon", "typo"}
This takes about 10 minutes to execute, and I'm interested in learning about an approach that is significantly faster. Thanks!