class Solution { public: int numSpecialEquivGroups(vector<string>& A) { set<string> ST; for (auto a : A) { vector<char> V1; vector<char> V2; for (int i = 0; i < a.length(); i++) { if (i % 2 == 0)//下标偶数位:0 2 4 6 8... { V1.push_back(a[i]); } else//下标奇数位1 3 5 7 9... { V2.push_back(a[i]); } } sort(V1.begin(), V1.end()); sort(V2.begin(), V2.end()); string X = ""; for (auto v : V1) { X.push_back(v); } for (auto v : V2) { X.push_back(v); } if (ST.find(X) == ST.end())//没有这条记录 { ST.insert(X); } } int count = ST.size(); return count; } };