#include<bits/stdc++.h>
using namespace std;
char s[1200],ch1[120],ch2[120];
int t=1,k=1;
bool fl;
int main(){
int x=0;
while(s[x]!='\n'){
x++;
s[x]=getchar();
}
scanf("%s\n%s",ch1+1,ch2+1);
while(s[t-1]!='\n'){
if(s[t]==' '||s[t]=='\n'){
fl=true;
for(int i=k;i<t;i++)
if(s[i]!=ch1[i-k+1]||i-k+1>strlen(ch1+1)){
fl=false;
break;
}
if(fl){
printf("%s",ch2+1);
printf("%c",s[t]);
}
else
for(int i=k;i<=t;i++)
printf("%c",s[i]);
k=t+1;
}
t++;
}
return 0;
}
哪里有问题啊?