using System;

class Program
    {
        static void Cenzura(string s, string t)
        {
            int rb = 0;
            int min = int.MaxValue;
            int br = 1;
            int[] niz = new int[s.Length];

            for (int i = 1; i < t.Length; i++)
            {
                if (t[i-1] == t[i]) {br++;niz[rb] = br;}
                else { br = 1; rb++;}
                if(niz[rb]==0)niz[rb]+=1;
            }
            for (int i = 1; i < niz.Length; i++) { if (min > niz[i]) {min = niz[i]; rb = i; }}
            Console.WriteLine(min);
            Console.WriteLine(t.Replace(s[rb], '*'));
        }

        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            string s = Console.ReadLine();
            //if (!Postoji(s) || !Postoji(t)) Console.WriteLine("Greska");
            if(t.Length>200000 || t.Length<1 || s.Length > 10 || s.Length < 1) Console.Error.WriteLine("Greska");
            Cenzura(s, t);
        }
    }