using System;


namespace takm_zad_4
{
    class Program
    {        static void Main(string[] args)
        {           
             string unos =Console.ReadLine();
            string pods = Console.ReadLine();
            char[] unoss = unos.ToCharArray();
            char[] podc = pods.ToCharArray();
            int lenght = podc.Length;
            int res = 0;
            int br = 0;
            int br2 = 0;
            for(int i = 0; i < unoss.Length; i++)
            {
                if (lenght == 1)
                {
                    if (unoss[i] == 'a')
                    {
                        res++;
                        unoss[i] = '*';
                    }
                }
                
                else
                {
                    if (unoss[i] == 'a')
                    {
                        br++;
                        if (br >= lenght)
                        {
                            unoss[i] = '*';
                            res++;
                        }
                    }
                    else br = 0;
                }
                }
                Console.WriteLine(res);
            for (int i = 0; i < unoss.Length; i++) Console.Write(unoss[i]);
            }
        }
    }