using System;

namespace Kvalifikacije_11_27
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string r = Console.ReadLine();
            int indexmin = 0, min = 2000000;

            int[] slova = new int[r.Length];
            for(int i = 0; i < r.Length; i++)
            {
                int bs = 0;
                for(int j = 0; j < s.Length; j++)
                {
                    if (r[i] == s[j])
                        bs++;

                }
                slova[i] = bs;

                if (slova[i] < min)
                {
                    min = slova[i];
                    indexmin = i;
                }
            }

            int br = 0;
            for (int i = 0; i < s.Length; i++)
            { 
                if (s[i] == r[indexmin])
                    br++;
            }
            
            Console.WriteLine(br);

            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == r[indexmin])
                    Console.Write("*");
                else
                    Console.Write(s[i]);
            }

        }
    }
}