using System;

namespace ConsoleApp18
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            int[] c = new int[b.Length];
            int br = 0;
            char[] ch = b.ToCharArray();
            char[] ch2 = a.ToCharArray();
            for (int i = 0; i <b.Length; i++)
            {
                for (int j = 0; j < a.Length; j++)
                {
                    if (ch[i]==ch2[j])
                    {
                        c[i]++;
                    }
                }
            }
            int min = 999;
            for (int i = 0; i < b.Length; i++)
            {
                if (c[i]<min)
                {
                    min = c[i];
                }
            }

            for (int i = 0; i < b.Length; i++)
            {
                if (min==c[i])
                {
                    foreach(char s in ch2)
                    {
                        if (s==b[i])
                        {

                            for (int j = 0; j < ch2.Length; j++)
                            {
                                if (ch2[j]==s)
                                {
                                    ch2[j] = '*';
                                    br++;
                                }
                            }
                        }
                    }
                }
            }
            string h = new string(ch2);
            Console.WriteLine(br);
            Console.WriteLine(ch2);
        }
    }
}