#include #include #include std::string replaceOtherStr(std::string &replacedStr, std::string from, std::string to) { const unsigned int pos = replacedStr.find(from); const int len = from.length(); if (pos == std::string::npos || from.empty()) { return replacedStr; } return replacedStr.replace(pos, len, to); } int main(void) { std::string s; std::cin >> s; replaceOtherStr(s, "treeone", "forest"); std::cout << s; }