Skip to content

Instantly share code, notes, and snippets.

@zed
Last active December 29, 2015 05:29
Show Gist options
  • Select an option

  • Save zed/7622403 to your computer and use it in GitHub Desktop.

Select an option

Save zed/7622403 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""Print words containing the same letter at least three times in a row.
http://stackoverflow.com/questions/20170022/elongated-word-check-in-sentence
"""
import re
words = open('/usr/share/dict/words')
#NOTE: support only ascii letters
elongated = re.compile(r'(?i)([a-z])\1{2,}').search
print("".join(filter(elongated, words)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment