Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.
class Solution {private: vectorresult; map > m;public: vector anagrams(vector &strs) { // Start typing your C/C++ solution below // DO NOT write int main() function result.clear(); m.clear(); int n = strs.size(); for(int i= 0; i< n;i++) { string tmp = strs[i]; sort(tmp.begin(), tmp.end()) ; m[tmp].push_back(strs[i]); } for(map >::iterator iter= m.begin(); iter != m.end(); iter++) { if((iter->second).size() >1) { for(int i= 0; i < (iter->second).size() ; i++ ) result.push_back((iter->second)[i]); } } return result; }};