Here is one approach:
Here's the code:
index.tsx587 chars26 lines
Note that this approach could be slow for large dictionary files, as it compares each word with all the previous ones. There are faster algorithms to solve this problem, such as using a variation of the bitset technique.
gistlibby LogSnag