字符串,水题
本题要点:
1、使用 string 的 find 和 replace 函数,每次读取一行,对该 string 操作,
然后输出即可
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
int pos;
while(getline(cin, str))
{
while((pos = str.find("you")) != -1)
str.replace(pos, 3, "we");
cout << str << endl;
}
return 0;
}
/*
you are what you do
*/
/*
we are what we do
*/