#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<queue>
#include<cassert>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<functional>
#include <sstream>
#include <fstream>
using namespace std;
const int maxn = 120000 + 10;
set<string>word;
string wrd[maxn];
#define FILE
int main()
{
#ifdef FILE
ifstream in("data.txt");
ofstream out("output.txt");
cin.rdbuf(in.rdbuf());
cout.rdbuf(out.rdbuf());
#endif
int cnt = 0;
string buf;
while (cin >> buf)
{
word.insert(buf);
wrd[cnt] = buf;
cnt++;
}
word.clear();
// for(int i=0;i<cnt;i++)
// cout<<i<<wrd[i]<<endl;
for(int i=0;i<cnt;i++)
{
for(int j=0;j<i;j++)
{
string s1=wrd[i]+wrd[j];
// cout<<i<<j<<s1<<endl;
word.insert(s1);
}
for(int j=i+1;j<cnt;j++)
{
string s1=wrd[i]+wrd[j];
// cout<<i<<j<<s1<<endl;
word.insert(s1);
}
}
set<string>::iterator it;
for(it=word.begin();it!=word.end();it++)
cout<<*it<<endl;
for(int i=0;i<cnt;i++)
{
it=word.find(wrd[i]);
if(it!=word.end())
cout<<wrd[i]<<endl;
}
return 0;
}
不懂为啥是wa
uva10391
最新推荐文章于 2020-08-01 10:27:16 发布