标签:bsp bst tor for length substr span iter return
复合词(Compound Words,UVa 10391)。题目详情看这个:https://www.jianshu.com/p/7c43fb5f2ecd
#include <iostream> #include <cstring> #include <string> #include <set> using namespace std; set<string> dict; int main() { string x; while (cin >> x) dict.insert(x); for (set<string>::iterator it = dict.begin(); it != dict.end(); ++it) { string s = *it; int len = s.length(); for (int i = 1; i != len; ++i) { if (dict.count(s.substr(0, i)) && dict.count(s.substr(i, len - i))) { cout << s << endl; } } } return 0; }
一个FLAG #21# 复合词(Compound Words,UVa 10391)
标签:bsp bst tor for length substr span iter return
原文地址:https://www.cnblogs.com/xkxf/p/12815233.html