文章
224
粉丝
0
获赞
905
访问
34.7k
#include<iostream>
#include<vector>
using namespace std;
string str,res;
vector<string> ans;
int main()
{
getline(cin,str);
string a,b;
cin>>a>>b;
for(int i=0;i<str.size();i++)
{
if(str[i]==' ')
{
if(res!=a)
ans.push_back(res);
else
ans.push_back(b);
res="";
}
else
res+=str[i];
}
if(res!=a)
ans.push_back(res);
else
ans.push_back(b);
for(auto s:ans)
cout<<s<<" ";
return 0;
}
登录后发布评论
暂无评论,来抢沙发