美文网首页
UVA 10391 (Compound Words)

UVA 10391 (Compound Words)

作者: Gaolex | 来源:发表于2016-05-14 11:49 被阅读68次
Compound Words
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    vector<string> 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)

      本文链接:https://www.haomeiwen.com/subject/jkimrttx.html