#include <iostream>
#include <bits/stdc++.h>


using namespace std;


int main()
{
    string s1;
    string s2;
    cin>>s1>>s2;
    if(s2.size()==1 && s2[0]=='a')
    {
        int suma=0;
        for(int i=0; i<s1.size(); i++)
        {
            if(s1[i]=='a')
            {
                suma++;
                s1[i]='*';
            }

        }
        cout<<suma<<endl<<s1;
    }
    else
    cout<<s1;
}