#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { string str; while (getline(cin, str)) { while (str.find("you") != string ::npos) { int index = str.find("you"); str.erase(index, 3); str.insert(index, "we"); } cout << str << endl; } } |
Double click to view unformatted code.