class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { vector<string> v; unordered_map<string, vector<string>> map; vector<vector<string>> v2; for(auto s : strs) { sort(s.begin(), s.end()); v.push_back(s); } for(int i = 0; i < v.size(); i++) { map[v[i]].push_back(strs[i]); } for(auto s : map) { v2.push_back(s.second); } return v2; } };