I am currently visiting my brother in Maryland and his wife, Michele, likes doing the NYT Spelling Bee. It’s a word puzzle where you get 7 letters and one of the 7 is required, with a minimum length of 4 letters. Letters can be repeated in a word. There is at least one word that uses every character.
This raises the question, given a list of words what is the shortest piece of code to give all possible answer words. I think I’m close with a single awk command.
bee() { ; awk "/^[$1]{4,}$/ && /$2/" /usr/share/dict/words ; }
You call the function bee <letters> <letter required>
. For example the puzzle on September 12 is bee gviotnp t
.
As I cannot get the list of words the NYT is using I am using the word list on my Mac which returns more words than the NYT. If I could find a shorter word list closer to the NYT list it would improve the output.