Skip to content

Instantly share code, notes, and snippets.

@mettler
Created December 18, 2021 05:38
Show Gist options
  • Save mettler/a4db0a725ea86f75cad0ee9db9e3cd9e to your computer and use it in GitHub Desktop.
Save mettler/a4db0a725ea86f75cad0ee9db9e3cd9e to your computer and use it in GitHub Desktop.
def load_words():
with open('words.txt') as word_file:
valid_words = set(word_file.read().split())
return valid_words
if __name__ == '__main__':
english_words = load_words()
for word in english_words:
word = word.replace('-', '')
if len(word) > 4:
firsthalf = ""
secondhalf = ""
for i, c in enumerate(word):
if (i % 2) == 0:
firsthalf += c
else:
secondhalf += c
if (firsthalf + secondhalf) == word:
print (word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment