class Solution {
public:
map<string,vector<string>> m;
vector<vector<string>> groupAnagrams(vector<string>& strs)
{
vector<vector<string>> ret;
for(auto& s:strs)
{
auto tmp = s;
sort(tmp.begin(),tmp.end());
m[tmp].push_back(s);
}
for(auto& it:m)
{
ret.push_back(it.second);
}
return ret;
}
};