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