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

namespace Cenzura
{
    class Program
    {
        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            string s = Console.ReadLine();
            int min = int.MaxValue;
            char c = 'a';
            for (int i = 0; i < s.Length; i++)
            {
                int b = 0;
                for (int j = 0; j < t.Length; j++)
                {
                    if (t[j] == s[i])
                        b++;
                }
                if (b < min)
                {
                    min = b;
                    c = s[i];
                }
            }
            Console.WriteLine(min);
            for (int i = 0; i < t.Length; i++)
            {
                if (t[i] == c)
                    Console.Write('*');
                else
                    Console.Write(t[i]);
            }
        }
    }
}