题目链接如下:
Online Judge文章来源:https://www.toymoban.com/news/detail-718007.html
代码如下:文章来源地址https://www.toymoban.com/news/detail-718007.html
#include <iostream>
#include <string>
#include <vector>
#include <set>
// #define debug
int main(){
#ifdef debug
freopen("0.txt", "r", stdin);
freopen("1.txt", "w", stdout);
#endif
std::string word;
std::vector<std::string> vec;
std::set<std::string> st;
while (std::cin >> word){
vec.push_back(word);
st.insert(word);
}
for (int i = 0; i < vec.size(); ++i){
for (int j = 1; j < vec[i].size(); ++j){
if(st.count(vec[i].substr(0, j)) && st.count(vec[i].substr(j))){
std::cout << vec[i] << std::endl;
break;
}
}
}
#ifdef debug
fclose(stdin);
fclose(stdout);
#endif
return 0;
}
到了这里,关于10391 - Compound Words (UVA)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!