链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=113

 

直接用string类里的fin()和replace()成员函数即可

 

#include <iostream>
#include<string>
using namespace std;
int main()
{
    string data;
    int t;
    int s;
    while(getline(cin,data))
    {
        t=0;s=0;
        while(s<data.length())
        {

            t=data.find("you",s);
            if(t==-1)
                break;
                s=t;
            data.replace(s,3,"we");
            s++;
        }
        cout<<data<<endl;
    }
    return 0;
}