#include <iostream>
#include <string>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
string key;
string temp;
while (getline(cin,key))
{
getline(cin, temp);
size_t tmp;
while ((tmp = temp.find(key)) != string::npos)
{
cout << temp.substr(0, tmp) << endl;
temp.erase(0, tmp + key.length());
}
cout << temp << endl;
}
return 0;
}