using System;

namespace Takmicenja
{
    class Program
    {
        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            string s = Console.ReadLine();
            char[] t1 = new char[t.Length];
            char[] s1 = new char[s.Length];
            int[] x1 = new int[s.Length];
            for (int i = 0; i < t.Length; i++)
            {
                t1[i] = t[i];
            }
            for (int i = 0; i < s.Length; i++)
            {
                s1[i] = s[i];
            }
            for (int i = 0; i < s.Length; i++)
            {
                for (int j = 0; j < t.Length; j++)
                {
                    if (s1[i] == t1[j])
                    {
                        x1[i]++;
                    }
                }
            }
            int min = x1[0];
            char m = t1[0];
            for (int i = 0; i < s.Length; i++)
            {
                if (min > x1[i])
                {
                    min = x1[i];
                    m = s1[i];
                }
            }
            Console.WriteLine(min);
            for (int i = 0; i < t.Length; i++)
            {
                if (m == t1[i])
                {
                    Console.Write("*");
                }
                else
                {
                    Console.Write(t1[i]);
                }
            }
        }
    }
}