#include <iostream>
#include <string>

using namespace std;

int main()
{
    int a,n=0,m=0,b,l=0;
    string text,zs;
    cin>>text;
    cin>>zs;
    a =text.length();
    b =zs.length();
    while(n!=a)
    {
        l=0;
        while(l!=b)
        {
        if(text[n]==zs[l])
        {
            text[n]='*';
            m++;
        }
        l++;
        }
        n++;
    }
    cout<<m<<endl;
    cout<<text;
    return 0;
}