Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Created May 25, 2013 07:27
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 vgmoose/5648263 to your computer and use it in GitHub Desktop.
Save vgmoose/5648263 to your computer and use it in GitHub Desktop.
import sys
if len(sys.argv) <= 1:
sys.argv.append("/usr/share/dict/words")
f = open(sys.argv[1], "r")
order = "qazwsxedcrfvtgbyhnujmikolp"
for line in f:
high = -1
word = ""
for c in line:
if c in order:
pos = order.index(c)
if pos > high:
word += c
high = pos
else:
high = -1
break
if high != -1:
print word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment