using System;

namespace Cenzura
{
    class Program
    {
        static void Zameni(string t, int i)
        {
            string t2 = "";
            for (int j = 0; j < t.Length; j++)
            {
                if (j == i)
                {
                    t2 += '*';
                }
                else
                {
                    t2 += t[j];
                }
            }
            t = "";
            t += t2;
        }
        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            string s = Console.ReadLine();
            string t2 = "";
            int br = 0;
            if (s.Length == 1)
            {
                for (int i = 0; i < t.Length; i++)
                {
                    if (t[i] == s[0])
                    {
                        t2 += '*';
                        br++;
                    }
                    else
                    {
                        t2 += t[i];
                    }
                }
            }
            else if (s.Length == 2)
            {
                t2+=t[0];
                for (int i = 1; i < t.Length; i++)
                {
                    if (t[i - 1] == s[0] && t[i] == s[1])
                    {
                        Zameni(t, i - 1);
                        br++;
                    }
                }
            }
            else
            {
                for (int i = 2; i < s.Length; i++)
                {
                    for (int j = 2; j < t.Length; j++)
                    {
                        if (t[j - 2] == s[i - 2] && t[j - 1] == s[i - 1] && t[j] == s[i])
                        {
                            Zameni(t, j - 1);
                            br++;
                        }
                    }
                }
            }
            Console.WriteLine(br);
            Console.WriteLine(t);
            Console.ReadLine();
        }
    }
}