using System;

namespace cenzura
{
    class Program
    {
        static void Main(string[] args)
        {
            string T = Console.ReadLine();
            string S = Console.ReadLine();
            char[] sls=S.ToCharArray();
            char[] t = T.ToCharArray();
            int brp = 0;
            int min =200000;
            int ind = 0;
            int[] count = new int[S.Length];
            for (int i = 0; i < S.Length; i++)
            {
                for (int j = 0; j < T.Length; j++)
                {
                    if (t[j]==sls[i])
                    {
                        count[i]++;
                    }
                }
            }
            for (int i = 0; i < count.Length; i++)
            {
                if (count[i]<min)
                {
                    min = count[i];
                    ind = i;
                }
            }
            for (int i = 0; i < S.Length; i++)
            {
                for (int j = 0; j < T.Length; j++)
                {
                    if (t[j] == sls[i]&& i==ind )
                    {
                        t[j] = '*' ;
                    }
                }
            }
            S = new string(t);
            Console.WriteLine(min);
            Console.WriteLine(S);
        }
    }
}