#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
char str[31];
scanf("%s",str);
char c;
scanf("\n%c",&c);//要写成"\n%c"要不读入的为回车
for(int i=0;str[i];i++)//char数组最后为\0
if(str[i]==c)
str[i]='#';
puts(str);
return 0;
}