using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] t = Console.ReadLine().ToCharArray();
            char[] s = Console.ReadLine().ToCharArray();
            int[] br = new int[s.Length];
            char lmin = ' ';
            char cmin = ' '; 
            int j = 0, min = int.MaxValue, imin = 0;
            for (int i = 0; i < s.Length; i++)
            {
                for(int p = 0; p < t.Length; p++)
                {
                    if (s[i] == t[p])
                    {
                        imin++;
                        lmin = t[p];
                    }
                }
                if (imin < min)
                {
                    min = imin;
                    cmin = lmin;
                }
                imin = 0;
            }
            Console.WriteLine("{0}", min);
            for (int i = 0; i < t.Length; i++)
            {
                if (t[i] == cmin) t[i] = '*';
                Console.Write(t[i]);
            }
            Console.ReadLine();
        }
    }
}