#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string findw(size_t from, string input) { std::size_t found = 0; std::size_t tmp_found = 0; // cout << "from-found+3 = " << (from-found+3) << " from = " << from << endl; while ((found = input.find("w",found))!=std::string::npos && (found max_count) { ret.clear(); max_count = count; string hoge = findw(found-count*3,input); // cout << "found = " << found << "hoge = " << hoge << endl; if (hoge != "") ret.push_back(hoge); } else if (max_count == count) { string hoge = findw(found-count*3,input); // cout << "found = " << found << "hoge = " << hoge << endl; if (hoge != "") ret.push_back(hoge); } tmp_found = found; found += 3; } for (int i = 0; i < ret.size(); i++) { cout << ret[i] << endl; } if (ret.size() == 0) cout << "" << endl; return 0; }