View Code of Problem 3496

#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.


Back to problem 3496