#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>

std::string shortest(std::string a) {
    std::string res = "";
    std::string min = "............................";
    char prev = a[0];
    int sIndex = 0;
    int eIndex = 0;
    for (int i = 0; i < a.length(); i++) {
        if (a[i] != prev) {
            if (min.length() > (res).length()) {
                min = res;
                sIndex = i - res.length() -1;
                eIndex = i;
            }

            prev = a[i];
            res = "";
        }
        else {
            res += a[i];
        }
    }
    if (min.length() > (res).length()) {
        sIndex = a.length() - res.length() - 1;
        eIndex = a.length();
    }
    if (sIndex == -1) sIndex = 0;
    a.replace(a.begin() + sIndex, a.begin() + eIndex, std::string(eIndex-sIndex, '*'));
    return a;
}

int main()
{
    std::string a, b;
    std::cin >> a >> b;


    char prev = '\0';
    int index = 0;
    int starting = 0;
    bool s = false;

    for (int i = 0; i < a.length(); i++) {
        if (a[i] == b[0] && !s) {
            s = true;
            prev = a[i];
            index = 0;
            starting = i;
        }
        else if (s) {
            if (a[i] != b[index]) {
                index++;
                if (index >= b.length()) {
                    std::string subst = a.substr(starting, i - starting);
                    a.replace(a.begin() + starting, a.begin() + starting + subst.length(), shortest(subst));
                    i = 0;
                    s = false;
                }
                if (a[i] == b[index]) {
                    while (a[i] == b[index]) {
                        index++;
                        if (index >= b.length()) {
                            std::string subst = a.substr(starting, i - starting);
                            a.replace(a.begin() + starting, a.begin() + starting + subst.length(), shortest(subst));
                            i = 0;
                            s = false;
                            break;
                        }
                    }

                    index--;
                }
                else {
                    s = false;
                }
            }

        }
    }
    if (s && index == b.length()-1) {
        std::string subst = a.substr(starting, a.length() - starting);
        a.replace(a.begin() + starting, a.begin() + starting + subst.length(), shortest(subst));

        s = false;
    }
    
    std::cout << a << std::endl;
}