NYOJ 113

 1 #include<iostream>

 2 #include<string>

 3 using namespace std;

 4 

 5 int main()

 6 {

 7      int pos=-1;

 8      string s;

 9      while(getline(cin,s))

10      {

11           while((pos=s.find("you",pos+1))!=s.npos)//不可写成s::npos 

12                s.replace(pos,3,"we");

13           cout<<s<<endl;

14      }

15      return 0;

16 }

 

你可能感兴趣的:(OJ)