Simple C++ code using map.
\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n       vector<vector<string>>res;\n        unordered_map<string,v
```\nclass Solution {\npublic:\n    vector<vector<string>> groupAnagrams(vector<string>& strs) {\n       vector<vector<string>>res;\n        unordered_map<string,vector<string>>mp;\n        for(auto&i: strs)\n            {\n \xA0 \xA0 \xA0 \xA0 \xA0 \xA0string t=i;//created a copy\n\t\t\t\n \xA0 \xA0 \xA0 \xA0 \xA0 \xA0sort(t.begin(),t.end());//sorted to get the key\n \xA0 \xA0 \xA0 \xA0 \xA0 \xA0mp[t].push_back(i);//pushed the initial string in map\n \xA0 \xA0 \xA0 \xA0}\n        for(auto&i:mp)\n            {\n            res.push_back(i.second);\n            }\n        return res;\n    }\n};\n```\nWe created a map with string as key and vector of strings as value. As anagrams are just rearrangement of same set of letters , so if we sort them we will get a same string for all anagrams . So using that as a key we store the strings and then return them as answer.\nAny suggestions are welcomed in the comments \uD83D\uDE03
[]