#include <iostream>
#include <string>

using namespace std;

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