#include <iostream>
#include <string>
typedef unsigned int ui;
using namespace std;
int main()
{
    string a, b;
    cin >> a;
    cin >> b;
    int br = 0;
        for (ui i = 1; i <= a.length(); i++)
        {
            ui r = a.length() - i;
            if (a[r] == 'a')
            {
                if (br < b.length() - 1) {
                    br++;
                    continue;
                }
                else {
                    a[r] = '*';
                }
            }
        }
        cout << a;
    return 0;
}