ACM 字符串替换
字符串替換
時間限制:3000?ms ?|? 內存限制:65535?KB 難度:2 描述每行數據是一個字符串,長度不超過1000?
數據以EOF結束
?
#include <iostream> #include <string> using namespace std;int main(){string str;while(getline(cin,str)){int pos = 0;while((pos = str.find("you",pos))!=string::npos){str.replace(str.begin()+pos,str.begin()+pos+3,"we");pos =pos+3;}cout<<str<<endl;} }?
轉載于:https://www.cnblogs.com/xiongqiangcs/p/3642813.html
總結
- 上一篇: 视觉基础与开发思路-第九节形态学操作
- 下一篇: 相关资源