//
//  main.cpp
//  cenzura
//
//  Created by Sara on 27.11.21..
//

#include <iostream>

#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
    string str, sub;
    cin>>str>>sub;
    unsigned long int  m = sub.length(), n= str.length();

    long long unsigned int letters[m];
    for (auto i = 0 ; i < m; i ++){
        letters[i]=0;
    }
    int j=-1,tj=0;

    for (auto i =0; i < n; i ++){
        
        if (str[i]==sub[tj]){
            tj++;
            letters[j+1]++;
            j++;
            continue;
        }
        if (j!=-1){
            if (str[i]==sub[j]){
                letters[j]++;
            }
        }
        
    }
    vector<unsigned long int> let, occ;
    let.push_back(sub[0]);
    occ.push_back(letters[0]);
    for (auto i =1; i < m; i ++){
        if (sub[i]==sub[i-1]){
            occ.back()+=letters[i];
        }
        else{
            occ.push_back(letters[i]);
            let.push_back(sub[i]);
        }
    }
    long unsigned int min=occ[0],index=0;
    char lmin=let[0];
    for (auto i =1; i < occ.size(); i ++){
        if (occ[i]<min){
            min=occ[i];
            lmin=let[i];
            index=i;
        }
    }
    j=0;
    for (auto i =0 ; i <n; i ++ ){
        if (j==index && lmin==str[i]){
            str[i]='*';
            occ[j]--;
            if (occ[j]==0){
                break;
            }
        }
        else{
            occ[j]--;
            if (occ[j]==0){
                j++;
            }
        }
    }
    cout<<str<<endl;
    
    return 0;
}