#include<iostream>
#include<cstring>
using namespace std;
int main()
{
string str;
getline(cin,str);
char c;
cin >> c;
for(int i = 0;str[i];i ++)
{
if(str[i] == c) str[i] = '#';
}
cout << str << endl;
return 0;
}