<s> __author__ = "<STR_LIT>" <EOL> '''<STR_LIT>''' <EOL> from collections import defaultdict <EOL> def sort_anagrams_together ( l1 ) : <EOL> '''<STR_LIT>''' <EOL> result = [ ] <EOL> dict_aux = defaultdict ( list ) <EOL> for word in l1 : <EOL> key = '<STR_LIT>' . join ( sorted ( word ) ) <EOL> dict_aux [ key ] . append ( word ) <EOL> for key in dict_aux : <EOL> result . extend ( dict_aux [ key ] ) <EOL> return result <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import doctest <EOL> doctest . testmod ( ) </s>
