#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s, z;
    cin>>s;
    cin>>z;

    int sL = s.length();
    int zL = z.length();
    int br = 0;

    string s1 = "";

    if(zL == 1 && z[0] == 'a')
    {
        for(int i = 0; i < sL; i++)
        {
            if(s[i] == 'a')
            {
                s1.push_back('*');
                br++;
            }
            else s1.push_back(s[i]);
        }
    }


    cout<<br<<endl;
    cout<<s1;

    return 0;
}