#include <iostream>
using namespace std;
int main(){
    string str;
    string podstr;
    cin>>str;
    cin>>podstr;
    int minimum=200000;
    int indeks;
    int minindeks;
    int j=0;
    int suma=0;
    for(int i=0;i<str.length();i++){
        if(str[i]==podstr[j]){
            int m=1;
            indeks=i;
            while(str[i+1]==str[i]){
                m++;
                i++;
            }
            if(m<minimum){
                minimum=m;
                minindeks=indeks;
            }
            j++;
            if(j==podstr.length()){
                for(int j=0;j<minimum;j++){
                    str[minindeks+j]='*';
                }
                j=0;
                suma+=minimum;
                minimum=200000;
            }
        }
    }
    cout<<suma<<endl;
    cout<<str<<endl;
    return 0;
}