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 }
NYOJ 113
作者:火星十一郎
本文版权归作者火星十一郎所有,欢迎转载和商用,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.