点击查看代码
#include<bits/stdc++.h>
using namespace std;
char s[210],a[110],b[110];
int la,lb,ls,nowtop,nowend=-1,nowoutput=1;
int main()
{
while(1)
{
char now_input;
scanf("%c",&now_input);
if(now_input=='\n')
break;
s[++ls]=now_input;
}
while(1)
{
char now_input;
scanf("%c",&now_input);
if(now_input=='\n')
break;
a[++la]=now_input;
}
/*while(1)
{
char now_input;
scanf("%c",&now_input);
if(now_input=='\n')
break;
b[++lb]=now_input;
}*/
while(scanf("%c",&b[++lb])!=EOF)
{
}
lb--;
//cout<<ls<<" "<<la<<" "<<lb<<endl;
for(int i=1;i<=ls;i++)
{
if(a[1]==s[i]&&nowend!=i-1)
{
nowtop=i;
}
nowend=i;
if(a[i-nowtop+1]==s[i])
{
if(nowend-nowtop+1==la)
{
for(int j=1;j<=lb;j++)
{
cout<<b[j];
}
nowend=i+1;
nowtop=0;
nowoutput=i+1;
}
continue;
}
else
nowtop=i+1;
if(nowoutput==0)
nowoutput++;
for(int j=nowoutput;j<=nowend;j++)
{
cout<<s[j];
}
//cout<<nowoutput<<" "<<nowend<<" ";
nowoutput=nowend+1;
//cout<<nowoutput<<endl;
}
}