#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
vector<string> strs;
int n;
string temp;
cin >> n;
for (int i = 0; i < n; i++){
cin >> temp;
strs.push_back(temp);
}
vector<string> result;
map<string,vector<string>> ma;
for (int i = 0; i < strs.size(); i++){
string temp = strs[i];
sort(temp.begin(), temp.end());
ma[temp].push_back(strs[i]);
}
//map<string, string>::iterator it2;
for (auto it2 = ma.begin(); it2 != ma.end(); it2++){
if (it2->second.size()>1){
result.insert(result.end(), it2->second.begin(), it2->second.end());
}
}
for (auto it = result.begin(); it != result.end(); it++)
cout << *it << endl;
return 0;
}
判断组成回文的字符串序列
最新推荐文章于 2024-09-02 18:47:33 发布