class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
word = {}
for str in strs:
key = ''.join(sorted(str))
if key in word.keys():
word[key].append(str)
else:
word[key] = [str]
res = []
for value in word.values():
res.append(value)
return res