#include <stdio.h>
#include <string.h>
#include <math.h>
int Cenzura(char S[200], char T[30000], int c, int M, int l)
{
    int i, k = 0, m, min, p, pz, dok;
    dok = l + c;
    min = c;
    for (i = l; i < dok; i++)
    {
        for (p = i; S[k] == T[p] && p < dok; p++)
        {
            m++;
        }
        if (min >= m)
        {
            min = m;
            pz = i;
        }
        m = 0;
        k++;
        if (p > i)
            i = p - 1;
    }
    for (i = 0; i < min; i++, pz++)
        T[pz] = '*';
    return min;
}
int main()
{
    char S[200], T[30000];
    int M, N, i, c = 0, k = 0, br = 0, j, p;
    gets(T);
    gets(S);
    N = strlen(T);
    M = strlen(S);
    for (i = 0; i < N; i++)
    {
        for (p = i, k = 0, c = 0; S[k] == T[p] && p < N; p++)
        {
            c++;
            if (S[k + 1] == T[p + 1] && k != M - 1)
                k++;
        }
        if (S[M - 1] == T[p - 1] && c >= M)
            br += Cenzura(S, T, c, M, i);
        if (p > i)
            i = p - 1;
    }
    printf("%d\n", br);
    puts(T);
    return 0;
}