<s> class Solution ( object ) : <EOL> def groupAnagrams ( self , strs ) : <EOL> """<STR_LIT>""" <EOL> anagrams_map , result = collections . defaultdict ( list ) , [ ] <EOL> for s in strs : <EOL> sorted_str = ( "<STR_LIT>" ) . join ( sorted ( s ) ) <EOL> anagrams_map [ sorted_str ] . append ( s ) <EOL> for anagram in anagrams_map . values ( ) : <EOL> anagram . sort ( ) <EOL> result . append ( anagram ) <EOL> return result <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> result = Solution ( ) . anagrams ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> print result </s>
