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

namespace cetvrti_zadatak
{
    public class AlNaPapir
    {
        public static void Main()
        {
            //input
            string sva_slova = Console.ReadLine();
            string ne_sme = Console.ReadLine();
            char[] niz = new char[sva_slova.Length];
            char cenzura = 'c';
            int min = 100000;
            for (int i = 0; i < sva_slova.Length; i++)
            {
                niz[i] = sva_slova[i];
            }

            for (int i = 0; i < ne_sme.Length; i++)
            {
                if (niz.Contains(ne_sme[i]))
                {
                    int kolko_ima = niz.Count(x => (x == ne_sme[i]));
                    if (kolko_ima < min)
                    {
                        min = kolko_ima;
                        cenzura = ne_sme[i];
                    }

                }
            }
            Console.WriteLine(min);
            for (int i = 0; i < sva_slova.Length; i++)
            {
                if (niz[i] == cenzura)
                    Console.Write("*");
                else
                    Console.Write(niz[i]);
            }

        }
    }
}