#include <iostream>
#include <string>

using namespace std;

int main()
{
    string T;
    string S;

    cin >> T >> S;

    int Tlen = T.length();
    int Slen = S.length();

    if (Slen == 1)
    {
        int ac = 0;
        for (int i = 0; i < Tlen; i++)
        {
            if (T[i] == S[0])
            {
                T[i] = '*';
                ac++;
            }
        }
        cout << ac << "\n" << T << endl;
    }

    else
    {
        int ac = 0;
        bool t = true;
        for (int i = 0; i < Tlen; i++)
        {
            if (T[i] == S[0])
            {
                ac++;
            }
        }
        ac -= (Slen - 1);
        cout << ac << endl;
        for (int i = 0; i < Tlen; i++)
        {
            if (T[i] == S[0] && t)
            {
                T[i] = '*';
                ac--;
                cout << T[i];
                if (ac == 0)
                {
                    t=false;
                }
            }
            else
            {
                cout << T[i];
            }
        }
        cout << endl;
    }


}