Given an array of lowercase strings, group the strings that are anagrams of one another.
Return groups in the order their character signature first appears, and keep words inside each group in input order.
Inputwords = ["eat", "tea", "tan", "ate", "nat", "bat"]
Output[["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
eat, tea, and ate share one set of letter counts. tan and nat share another, and bat forms its own group. The groups follow the order in which they first appear.
Inputwords = ["a"]
Output[["a"]]
The only word forms one group, so the result is a list containing that group.
1 ≤ words.length ≤ 10,000