Skip to content

Instantly share code, notes, and snippets.

@darius
Created August 14, 2013 20:48
Show Gist options
  • Select an option

  • Save darius/6235430 to your computer and use it in GitHub Desktop.

Select an option

Save darius/6235430 to your computer and use it in GitHub Desktop.
words = map(str.rstrip, open('sowpods.txt').read().splitlines())
pals = {}
for word in words:
pals.setdefault(''.join(sorted(word)), []).append(word)
print(pals[max((word for word, clique in pals.iteritems() if 1 < len(clique)), key=len)])
#. ['CONSTRUCTIONISM', 'MISCONSTRUCTION']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment