Created
March 5, 2013 21:05
-
-
Save betodealmeida/5094271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = { word.strip(): None for word in open('/usr/share/dict/words') } | |
four = [word for word in words.keys() if len(word) == 4] | |
for left in four: | |
for right in four: | |
combined = ''.join([ left[j] + right[j] for j in range(4) ]) | |
for word in words: | |
if not combined.startswith(word): | |
continue | |
rest = combined[len(word):] | |
if not rest or rest in words: | |
print left, right, word, rest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment