"""
Enter jumbled word as argument. Loads a line separated file called 'dictionary'
Exits silently if no word provided
"""
import sys, itertools
if len(sys.argv) != 2: exit(1)
en_dict = dict(((line.strip(), None) for line in open('dictionary','r') if len(line.strip()) > 1))
print [perm for perm in itertools.chain(*((''.join(perm) for perm in itertools.permutations(sys.argv[1], word_len)) for word_len in xrange(2, len(sys.argv[1])+1))) if perm in en_dict]
# generated using quickhighlighter.com