Cpp Easy using sorting and hashmap


#1
    indent preformatted text by 4 spaces

unordered_map<string,vector>m;

for(int i=0;i<a.size();i++){
    string s=a[i];
    sort(s.begin(),s.end());
   
    m[s].push_back(i+1);
}
vector<vector<int>>ans;
for(auto x: m){
    ans.push_back(x.second);
}
return ans;