equal
deleted
inserted
replaced
|
1 anag = {} |
|
2 for line in open( 'anag.txt'): |
|
3 word = line.strip() |
|
4 key = ''.join(sorted(list(word))) |
|
5 if key not in anag: |
|
6 anag[ key ] = [ word ] |
|
7 else: |
|
8 anag[key].append(word) |
|
9 for key in anag: |
|
10 if len(anag[key]) > 1: |
|
11 print anag[key] |
|
12 |