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 t1 = t;
            string s = Console.ReadLine();
            int r = 0;
            if(s=="a")
            {
                for (int i = 0; i < t.Length; i++)
                {
                    if(t[i].ToString()==s)
                    {
                        r++;
                    }
                }
                t.Replace('a', '*');
                Console.WriteLine(r);
                Console.WriteLine(t);
            }
            else if(s=="ab")
            {
                int l = 0;
                int l1 = t.Length-1;
                for (int i = 0; i < t.Length; i++)
                {
                    if (t[i].ToString() == "a")
                    {
                        l += 1;
                        break;
                    }
                    else l++;
                }
                for (int i = t.Length-1; i >= 0; i--)
                {
                    if (t[i].ToString() == "b")
                    {
                        l1 -= 1;
                        break;
                    }
                    else l1--;
                }
                if(l1<=l)
                {
                    Console.WriteLine(0);
                    Console.WriteLine(t);
                }
                else
                {

                }
            }
            else if(s=="abc")
            {

            }
            else
            {
                for (int i = 0; i < t.Length; i++)
                {
                    if (t[i].ToString() == s)
                    {
                        r++;
                    }
                }
                int zb = 0;
                if(r<s.Length)
                {
                    Console.WriteLine(0);
                    Console.WriteLine(t1);
                }
                else
                {
                    string e = "";
                    int br = 0;
                    zb = r - s.Length + 1;
                    Console.WriteLine(zb);
                    for (int i = 0; i < t.Length; i++)
                    {
                        if (t[i].ToString() == s)
                        {
                            if (br <= zb)
                            {
                                e += "*";
                                br++;
                            }
                        }
                        else e += t[i].ToString();
                    }
                    Console.WriteLine(e);
                }
            }
        }
    }
}