#include using namespace std; // s src , o old , n new string replaceWord(string s, const string o, const string n) { string::size_type pos = s.find(o); string::size_type size = o.size(); while (pos != string::npos) { s = s.replace(pos, size, n); pos = s.find(o); } return s; } void solve() { string s; cin >> s; s = replaceWord(s, "treeone", "forest"); cout << s << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); getchar(); }