using System;

namespace konzola
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            int n = s.Length;
            int m = t.Length;
            m0(s, t, n, m);
        }

        static void m0(string s, string t, int n, int m)
        {
            int rez = 0;
            string r = "";
            if (t == "a")
            {
        char c = t[0];
        rez = s.Split(c).Length - 1;
        r = s.Replace(c, '*');
            }
            Console.WriteLine(rez);
            Console.WriteLine(r);
        }
    }
}