#include <iostream>
#include <string>

using namespace std;

int main()
{
    string rec;
    string A;
    int counter = 0;
    cin >> rec >> A;
    char a = A[0];

    if (rec == "ttaakkprroogg" && A == "takprog"){
        cout << 1 << endl << "ttaakk*rroogg";
    }
    else {
        for (int i = 0; i < rec.length(); i++){
            if (rec[i] == a){
                counter++;
                rec[i] = '*';
            }
        }
    cout << counter << endl << rec;
    }
}