#include <stdio.h>
#include <string.h>
int main()
{
char sirInitial[500];
char sirCautat[50];
char sirInlocuit[50];
char rezultat[500];
gets(sirInitial);
gets(sirCautat);
gets(sirInlocuit);
unsigned poz = 0, aux = 0;
int lungimeSirInitial = strlen(sirInitial);
int lungimeSirInlocuit = strlen(sirInlocuit);
int lungimeSirCautat = strlen(sirCautat);
while(poz < lungimeSirInitial)
if(strstr(sirInitial + poz, sirCautat) == sirInitial + poz) {
rezultat[aux] = 0;
strcat(rezultat, sirInlocuit);
aux += lungimeSirInlocuit;
poz += lungimeSirCautat;
}
else
rezultat[aux++] = sirInitial[poz++];
rezultat[aux] = 0;
printf("%s\n", rezultat);
}