#include<string>
#include<iostream>
using namespace std;
int main(){
string str;
cin >> str;
char c;
cin >> c;
str += c;
string res;
for (int i = 0; i < str.size(); i++){
if (str[i] != c)
res += str[i];
if (str[i] == c )
{
cout << res << endl;
res.clear();
}
}
}