3 ms·
Dyalog APL, using the enable1 wordlist, I don't know its origins but you can get it from Peter Norvig's website https://norvig.com/ngrams/enable1.txt https://no
by jodrellblank 3y ago
Dyalog APL, using the enable1 wordlist, I don't know its origins but you can get it from Peter Norvig's website https://norvig.com/ngrams/enable1.txt https://norvig.com/ngrams/enable1.txt or various GitHubs and Gists:
↑7↑{⍵[⍒≢¨⍵]}words/⍨{''≡⍵~'qwertyuiop'}¨words
┌→─────────┐
↓peppertree│
│perpetuity│
│prerequire│
│proprietor│
│repertoire│
│typewriter│
│etiquette │
└──────────┘
Reading from the right, "test each word by removing 'qwertyuiop' and see if it leaves an empty string, use the test results to filter the input word list, descending-sort the length of each word and use that to arrange(index) the remaining words, flatten the array and take the top 7".
(Longest from the middle row is 'haggadahs' then 'alfalfas', third row is 'mm')