Given an array of strings words, group the words that are anagrams of each other.
You can return the groups in any order, and the words inside each group in any order.
Examples
Example 1
- Input
- words = ["eat", "tea", "tan", "ate", "nat", "bat"]
- Output
- [["bat"], ["nat", "tan"], ["ate", "eat", "tea"]]
Example 2
- Input
- words = [""]
- Output
- [[""]]
Example 3
- Input
- words = ["a"]
- Output
- [["a"]]
Constraints
1 <= words.length <= 10^40 <= words[i].length <= 100- Words contain only lowercase English letters.