using System;

namespace Petlja2
{
    class Program
    {
        static void Main(string[] args)
        {
            String a = Console.ReadLine();
            String b = Console.ReadLine();

            char pom = '0';
            int num = 0;
            int bignum = a.Length;
            for(int i = 0; i < b.Length; i++)
            {
                num = 0;
                for (int j = 0; j < a.Length; j++)
                {
                    if(b[i]==a[j])
                    {
                        num++;
                    }
                }
                if (num < bignum)
                {
                    pom = b[i];
                    bignum = num;
                }
            }

            Console.WriteLine(bignum);
            String d = a.Replace(pom, '*');
            
            Console.WriteLine(d);
        }
    }
}