Skip to content

Instantly share code, notes, and snippets.

@Thann
Created December 26, 2018 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thann/b9db8fde61c332906318cf595fc28156 to your computer and use it in GitHub Desktop.
Save Thann/b9db8fde61c332906318cf595fc28156 to your computer and use it in GitHub Desktop.
really slow anagram algorithm
import enchant
import itertools
sample = "atlas shrugged"
d = enchant.Dict("en_US")
for s in itertools.permutations(sample, len(sample)):
s = ''.join(s)
if all(d.check(p) for p in s.split(' ') if len(p)):
print('--->', s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment