NYOJ--113--字符串替换

时间:2023-03-09 17:04:31
NYOJ--113--字符串替换
/*
    Name: NYOJ--113--字符串替换
    Author: shen_渊
    Date: 18/04/17 15:41
    Description: 字符串水题,秒过
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    string str;
    const string syou = "you";
    const string swe = "we";
    while(getline(cin,str)){
        int pos;
        while((pos = str.find(syou)) != string::npos){
            str.erase(pos,);
            str.insert(pos,swe);
        }
        cout<<str<<endl;
    }
    ;
}