#include <iostream>
#include <cmath>
using namespace std;
int main() {
  int br,k1,k2,duzr,duzt;
  string text, rec;
  cin >> text;
  cin >> rec;
  duzr = rec.length();
  duzt = text.length();
  k1=k2=br=0;
  if (rec!="a")
  {
  do
    {
     if (text[k2] == 'a')
     {
      k1++;       
     }
    k2++;
    }
  while (k1<(duzr-1)&&k2<duzt);
  }
  
  do
    {
     if (text[k2] == 'a')
     {
      text[k2] = '*';
      br++;
     }
    k2++;
    }
  while (k2<duzt);
  cout << br <<endl;
  cout << text;
  return 0;
}