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

namespace Tekst
{
    class Program
    {
        static int[] Sadrzaj(string k, string s)
        {
            int[] a = new int[k.Length];
            for (int i = 0; i < k.Length; i++)
            {
                for (int j = 0; j < s.Length; j++)
                {
                    if (k[i]==s[j])
                    {
                        a[i]++;

                    }
                }
            }
            return a;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string k = Console.ReadLine();
            int[] a = Sadrzaj(k, s);
            int min = a[0];
            int poz=0;
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i]<min)
                {
                    min = a[i];
                    poz = i;
                }
            }

            char sl = k[poz];
            int poz2 = s.IndexOf(sl);
            char sl2 = s[poz2];
            string novi = "";
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == sl2)
                {
                    novi += "*";
                }
                else novi = Convert.ToString(novi + (char)s[i]);
            }
            Console.WriteLine(min);
            Console.WriteLine(novi);
        }
    }
}