C++ Simple, Short and Easy Solution, O(nm)
\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n        unordered_map<string, vector<string>> m;\n        string 
```\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n        unordered_map<string, vector<string>> m;\n        string tmp_sorted;\n        \n        for (auto word : strs) {\n            tmp_sorted = word;\n            sort(tmp_sorted.begin(), tmp_sorted.end());\n            m[tmp_sorted].push_back(word);\n        }\n        \n        vector<vector<string>> res;\n        for (auto [word, list] : m) {\n            res.push_back(list);\n        }\n        \n        return res;\n    }\n};\n```\n****\n**Faster solution, using Counting Sort, Time Complexity: O(nm)**\n```\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n        unordered_map<string, vector<string>> m;\n        string tmp_sorted;\n        \n        for (auto word : strs) {\n            tmp_sorted = countSort(word);\n            m[tmp_sorted].push_back(word);\n        }\n        \n        vector<vector<string>> res;\n        for (auto [word, list] : m) {\n            res.push_back(list);\n        }\n        \n        return res;\n    }\n    \n    string countSort(string word) {\n        vector<int> count(26);\n        string res;\n        \n        for (auto ch : word) count[ch - \'a\']++;\n        for (int i = 0; i < 26; i++) res += string(count[i], i+\'a\');\n        return res;\n    }\n};\n```\n**Like it? please upvote!**
['C']