#include<stdio.h>
#include<string.h>
int main()
{
char s[100][100],a[100],b[100];
int i=0,j=0,t=0,f,c,n;
scanf("%s",s[i]);
i++;
t++;
while(getchar()==' ')//输入该字符串
{
i++;
t++;
scanf("%s",s[i]);
}
scanf("%s",a);
scanf("%s",b);
c=strlen(b);
for(i=0;i<=t;i++)
{
if(strcmp(s[i],a)==0)//检查和代替换单词相同的
{
f=0;
for(f=0;f<c;f++)
{
s[i][f]=b[f];//替换
}
s[i][f]='\0';
}
}
for(i=0;i<=t;i++)//按照要求输出字符串
{
for(j=0;j<strlen(s[i]);j++)
{
printf("%c",s[i][j]);
}
printf(" ");
}
return 0;
}