#include <iostream>

int main(){
    std::ios_base::sync_with_stdio(false);

    std::string input;
    std::cin >> input;

    std::string forbidden;
    std::cin >> forbidden;

    int promene = 0;
    for (int i = 0; i < input.length(); i++){
        if (input[i] == forbidden[0]){
             input[i] = '*';
             promene++;
        }
    }

    std::cout << promene << "\n" << input;

    return 0;
}