Simple and short C++ solution with comments, beats 98% online submissions
\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n        // Base case\n\t\tif(strs.size() == 1)\n            retur
```\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n        // Base case\n\t\tif(strs.size() == 1)\n            return {{strs[0]}};\n        \n        vector<vector<string>> ans;\n        unordered_map<string, vector<string>> M;\n        for(int  i = 0; i < strs.size(); i++)\n        {\n            string str = strs[i];\n            sort(strs[i].begin(), strs[i].end()); // Sorting the string\n            M[strs[i]].push_back(str);  // Sorted string is the key and the value is the initial string\n        }\n        for(auto i = M.begin(); i != M.end(); i++)\n            ans.push_back(i -> second);  // Traversing the map and adding the vectors of string to ans\n        return ans;\n    }\n};\n```
['C', 'C++']