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

namespace cenzuraMutava
{
    internal class Program
    {
        static void Main(string[] args)
        {
            char[] text = Console.ReadLine().ToCharArray();
            string zabranjena = Console.ReadLine();
            if (zabranjena.Length == 1)
            {
            int suma = 0;
                for (int i = 0; i < text.Length; i++)
                {
                    if (text[i] == zabranjena[0])
                    {
                        text[i] = '*';
                        suma++;
                    }
                }
                Console.WriteLine(suma);
                Console.WriteLine(text);
            }
            else if (zabranjena.Length > 1)
            {
                int suma = 0;
                int brojacZaA = 0;
                for(int i = 0; i < text.Length; i++)
                {
                    if(text[i] == zabranjena[0])
                    {
                        ++brojacZaA;
                        if(brojacZaA>=zabranjena.Length)
                        {
                            text[i] = '*';
                            suma++;
                        }
                    }
                }
                Console.WriteLine(suma);
                Console.WriteLine(text);
            }
            bool[] tacnost = new bool[text.Length];
            if (zabranjena == "ab")
            {
                Console.WriteLine("ab");
            }
        }
    }
}