#include<iostream>
#include<cstdio>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int Length(string s)
{
int len=0;
for(int i=0;s[i]!='\0';i++)
{
len++;
}
return len;
}
vector<int>substringfind(string s,string sub)
{
int lens=Length(s);
int lensub=Length(sub);
vector<int>pos;
int paisi=0;
for(int i=0;i<=lens-lensub;i++)
{
int matched=0;
for(int j=0;j<lensub;j++)
{
if(sub[j]==s[i+j])
{
matched++;
continue;
}
else
break;
}
if(matched==lensub)
{
pos.push_back(i);
}
}
return pos;
}
string Delete(string s,string sub)
{
int lens=Length(s);
int lensub=Length(sub);
vector<int>pos;
pos=substringfind(s,sub);
string res=" ";
int kototomo=0;
for(int i=0;i<lens;i++)
{
if(kototomo>pos.size()||i!=pos[kototomo])
{
res=res+s[i];
}
else
{
i+=(lensub-1);
kototomo++;
}
}
return res;
}
int main()
{
string s,sub;
cin>>s>>sub;
string res=Delete(s,sub);
cout<<res<<endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdGRpbz4KI2luY2x1ZGU8dmVjdG9yPgojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgTGVuZ3RoKHN0cmluZyBzKQp7CmludCBsZW49MDsKZm9yKGludCBpPTA7c1tpXSE9J1wwJztpKyspCnsKbGVuKys7Cn0KcmV0dXJuIGxlbjsKfQp2ZWN0b3I8aW50PnN1YnN0cmluZ2ZpbmQoc3RyaW5nIHMsc3RyaW5nIHN1YikKewppbnQgbGVucz1MZW5ndGgocyk7CmludCBsZW5zdWI9TGVuZ3RoKHN1Yik7CnZlY3RvcjxpbnQ+cG9zOwppbnQgcGFpc2k9MDsKZm9yKGludCBpPTA7aTw9bGVucy1sZW5zdWI7aSsrKQp7CmludCBtYXRjaGVkPTA7CmZvcihpbnQgaj0wO2o8bGVuc3ViO2orKykKewppZihzdWJbal09PXNbaStqXSkKewptYXRjaGVkKys7CmNvbnRpbnVl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