#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1>>s2;
int p=-1;
while(s1.find(s2,p+1)!=-1){
p=s1.find(s2);
s1.erase(p,1);
}
p=s1.find(s2);
s1.erase(p,1);
cout <<s1;
return 0;
}
/**************************************************************
Problem: 1131
User: luyanchen
Language: C++
Result: Runtime Error
****************************************************************/