# 字母异位词分组

<p>给定一个字符串数组，将字母异位词组合在一起。字母异位词指字母相同，但排列不同的字符串。</p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong>[eat&quot;, &quot;tea&quot;, &quot;tan&quot;, &quot;ate&quot;, &quot;nat&quot;, &quot;bat&quot;]<strong><br />输出:</strong>[[ate&quot;,&quot;eat&quot;,&quot;tea&quot;],[&quot;nat&quot;,&quot;tan&quot;],[&quot;bat&quot;]]</pre>
<p><strong>说明：</strong></p>
<ul>
    <li>所有输入均为小写字母。</li>
    <li>不考虑答案输出的顺序。</li>
</ul>

## template

```python
class Solution(object):
	def groupAnagrams(self, strs):
		strs.sort()
		hash = {}
		for s in strs:
			key = self.hash_key(s)
			try:
				hash[key].append(s)
			except KeyError:
				hash[key] = [s]
		return hash.values()
	def hash_key(self, s):
		table = [0] * 26
		for ch in s:
			index = ord(ch) - ord('a')
			table[index] += 1
		return str(table)
# %%
s = Solution()
print(s.groupAnagrams(strs = ["eat", "tea", "tan", "ate", "nat", "bat"]))
```

## 答案

```python

```

## 选项

### A

```python

```

### B

```python

```

### C

```python

```