UVA 10391 (Compound Words)

Compound Words
#include 
#include 
#include 
using namespace std;
int main()
{
    vector wordbook;
    string word;
    while (cin>>word)
        wordbook.push_back(word);
    for (int i = 0; i < wordbook.size(); i++)
    {
        if (wordbook[i].size() <= 2)
            continue;
        else
            for (int j = 0; j < wordbook.size(); j++)
                for (int k = 0; k < wordbook.size(); k++)
                    if (wordbook[j]+wordbook[k]==wordbook[i])
                        cout << wordbook[i]<<'\n';
    }
    system("pause");
    return 0;
}

运行结果;

运行结果

你可能感兴趣的:(UVA 10391 (Compound Words))