using System;

class Program {
  public static void Main (string[] args) {
    string t = Console.ReadLine();
            string s = Console.ReadLine();
            int br = 0;
            if (s == "a")
            {
                for (int i = 0; i < t.Length; i++)
                {
                    if (t[i] == 'a')
                    {
                        t = t.Remove(i, 1).Insert(i, "*");
                        br++;
                    }
                }
                Console.WriteLine(br);
                Console.WriteLine(t);
            }
  }
}