65,187
社区成员




#include <iostream>
#include <fstream>
#include <set>
#include <string>
using namespace std;
int main()
{
ifstream is("abc.txt");
char str[20];
set<string> strings;
while(is.getline(str, 20))
{
string tmp(str);
if (strings.find(tmp) == strings.end())
{
strings.insert(tmp);
}
string tmp2;
for (string::reverse_iterator it = tmp.rbegin(); it != tmp.rend(); it++)
{
tmp2.push_back(*it);
}
if (strings.find(tmp2) != strings.end())
{
cout<<tmp2<<endl;
}
}
return 0;
}