哪个大佬帮忙看一下,谢谢
#include<bits/stdc++.h>
using namespace std;
string a[201];
string s,d,w,h="";
int main()
{
getline(cin,w);
w=' '+w+' ';
int num=1;
for(int t=1;t<w.size()-1;)
{
if(w[t-1]==' ')
{
h="";
while(w[t+1]!=' ')
{
if(t<w.size()-1)
{
h=h+w[t];
t++;
}
else break;
}
a[num]=h;
num++;
}
else t++;
}
cin>>s;
cin>>d;
for(int e=1;e<num;e++)
{
if(a[e]==s) a[e]=d;
cout<<a[e]<<" ";
}
return 0;
}