#include <iostream>
#include <string>

using namespace std;

int main()
{
   string s, t;
   int m, n, c = 0, d = 0;

   cin >> s >> t;
   m = s.length();
   n = t.length();

   if (s == "a")
   {
      for (int i = 0; i < n; i++)
         if (t[i] == 'a')
         {
            t[i] = '*';
            c++;
         }
   }
   else
   {
      for (int i = 0; i < n; i++)
         if (t[i] == 'a')
            d++;
      if (d >= m)
         for (int i = 0; i < n && d >= m; i++)
            if (t[i] == 'a')
            {
               t[i] = '*';
               c++;
               d--;
            }
   }

   cout << c << "\n"
        << t;
}