#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    string rec,zrec;
    int n,m;
    cin>>rec>>zrec;
    n=rec.length();
    m=zrec.length();
    bool t;
    t=false;
    if(n==m){
        for(int i=0;i<=n;i++){
            if(rec[i]==zrec[i]){
                t=true;    
            }
            else{
                t=false;
            }
        }
    }
    if(t==true){
        cout<<1<<endl;
        cout<<rec.erase(0,1);
    }
    int a;
    a=0;
    int br[10]{0};
        for (int i = 0; (i = rec.find(zrec[0], i)) != string::npos; i++)
            br[0]++;
        for (int i = 0; (i = rec.find(zrec[1], i)) != string::npos; i++)
            br[1]++;
        for (int i = 0; (i = rec.find(zrec[2], i)) != string::npos; i++) 
            br[2]++;
        for (int i = 0; (i = rec.find(zrec[3], i)) != string::npos; i++) 
            br[3]++;
        for (int i = 0; (i = rec.find(zrec[4], i)) != string::npos; i++) 
            br[4]++;
        for (int i = 0; (i = rec.find(zrec[5], i)) != string::npos; i++) 
            br[5]++;
        for (int i = 0; (i = rec.find(zrec[6], i)) != string::npos; i++) 
            br[6]++;
        for (int i = 0; (i = rec.find(zrec[7], i)) != string::npos; i++) 
            br[7]++;
        for (int i = 0; (i = rec.find(zrec[8], i)) != string::npos; i++) 
            br[8]++;
        for (int i = 0; (i = rec.find(zrec[9], i)) != string::npos; i++) 
            br[9]++;
    int min;
    min=br[0];
    if(br[1]<min && br[1]!=0){
    min=br[1];
    a=1;
    }
    if(br[2]<min&& br[2]!=0){
    min=br[2];
    a=2;
    }
    if(br[3]<min&& br[3]!=0){
    min=br[3];
    a=3;
    }
    if(br[4]<min&& br[4]!=0){
    min=br[4];
    a=4;
    }
    if(br[5]<min&& br[5]!=0){
    min=br[5];
    a=5;
    }
    if(br[6]<min&& br[6]!=0){
    min=br[6];
    a=6;
    }
    if(br[7]<min&& br[7]!=0){
    min=br[7];
    a=7;
    }
    if(br[8]<min&& br[8]!=0){
    min=br[8];
    a=8;
    }
    if(br[9]<min&& br[9]!=0){
    min=br[9];
    a=9;
    }
    cout<<min<<endl;
    replace( rec.begin(), rec.end(), zrec[a], '*');
    cout<<rec;
    
}