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

public class cppboljiodcs
{
    public static void Main()
    {
        string rec = Console.ReadLine();
        string zabranjena = Console.ReadLine();
        List<char> lista = new List<char>();
        for (int i = 0; i < rec.Length; i++)
        {
            lista.Add(rec[i]);
        }
        int min = int.MaxValue;
        char cenzura = ' ';
        for (int i = 0; i < zabranjena.Length; i++)
        {
            if (lista.Contains(zabranjena[i]))
            {
                int izbroj = lista.Count(x => x == zabranjena[i]);
                if (izbroj < min)
                {
                    min = izbroj;
                    cenzura = zabranjena[i];
                }

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

    }
}