#include <iostream>
#include <string>

using namespace std;

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

    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;
    }
}