UVa 10399
http://uva.onlinejudge.org/index.php?option=com_オンラインjudge&Itemid=8&page=show_problem&category=15&problem=1332&mosms=Submission+received+with+ID+11760306
構想は簡単です。ブログを書く目的はfind、substrの使い方を覚えることです。
構想は簡単です。ブログを書く目的はfind、substrの使い方を覚えることです。
#include<iostream>
#include<set>
using namespace std;
int main()
{
set<string> s;
string temp;
while (cin >> temp)
{
s.insert(temp);
}
for (set<string>::iterator it = s.begin(); it != s.end(); it++)
{
string a = *it;
for (int i = 1; i < a.length(); ++i)
{
if (s.find(a.substr(0, i)) != s.end() && s.find(a.substr(i, a.length() - i)) != s.end())//
{
cout << a << endl;
break;
}
}
}
}