#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
using namespace std;

int main()
{
    string str1,str2;
    cin >> str1;
    cin >> str2;

    bool allsame = true;

    for(int i = 0; i < str2.length()-1; i++)
    {
        if(str2[i] != str2[i+1])
        {
            allsame = false;
            break;
        }
    }

    if(str2.length() == 1)
    {
        int s = 0;
        for(int i = 0; i < str1.length(); i++)
        {
            if(str1[i] == str2[0])
            {
                str1[i]='*';
                s++;
            }
        }
        cout << s << endl;
        cout << str1;
    } else if(allsame) {
        int s = 0;
        int req = str2.length();
        for(int i = 0; i < str1.length(); i++)
        {
            if(count(str1.begin(), str1.end(), str2[0]) < req) break;
            if(str1[i] == str2[0]) {
                str1[i]='*';
                s++;
            }
        }
        cout << s << endl;
        cout << str1;
    } else {
        cout << 1 << endl;
    }
}