using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            string tekst = Console.ReadLine();
            string cenzurisati = Console.ReadLine();
            char[] slova = tekst.ToArray();
            long brojac = 0;
            long min = long.MaxValue;
            int pamti=0;
            if (cenzurisati.Length == 1)
            {
                char a = cenzurisati[0];
                brojac = slova.Count(x => x == a);
                Console.WriteLine(brojac);
                for (int i = 0; i < tekst.Length; i++)
                {
                    if (slova[i] == a)
                    {
                        Console.Write("*");
                    }
                    else
                    {
                        Console.Write(slova[i]);
                    }
                }
            }
            else
            {
                for(int i=0; i<cenzurisati.Length; i++)
                {
                    brojac = slova.Count(x => x == cenzurisati[i]);
                    if(brojac < min)
                    {
                        min = brojac;
                        pamti = i;
                    }
                }
                Console.WriteLine(min);
                for(int j=0; j<tekst.Length; j++)
                {
                    if (slova[j] == cenzurisati[pamti])
                    {
                        Console.Write("*");
                    }
                    else
                    {
                        Console.Write(slova[j]);
                    }
                }
            }
        }
    }
}