#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string t, s, r;
    cin >> t >> s;

    int br = 0;
    if(s[0] == 'a' && s[1] == '\0'){
        for(int i = 0; i < t.length(); i++){
            if(t[i] == 'a'){
                br++;
                r[i] = '*';
            }
            else r[i] = t[i];
        }
    }

    cout << br << endl;
    if(br > 0){
        for(int i = 0; i < t.length(); i++)
            cout << r[i];
    }
    return 0;
}