#include <bits/stdc++.h>

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

ll n, m;
string s, t;


int main(){
  cin >> s >> t;
  n = s.size();
  m = t.size();
  if(t == "a"){
    ll cnt = 0;
    for(int i = 0; i < n; ++i){
      if(s[i] == 'a'){++cnt;}
      s[i] = '*';
    }
    cout << cnt << endl;
    cout << s << endl;
    return 0;
  }
  bool ok = true;
  for(int i = 0; i < m; ++i){
    if(t[i] != 'a'){ok = false; break;}
  }
  if(ok){
    ll cnt = 0;
    for(int i = 0; i < n; ++i){
      if(s[i] == 'a'){++cnt;}
    }
    cout << max(0ll, cnt - m + 1) << endl;
    for(int i = 0; i < n; ++i){
      if(cnt >= m && s[i] == 'a'){s[i] = '*'; --cnt;}
    }
    cout << s << endl;
    return 0;
  }
  cout << 0 << endl;
  cout << s << endl;
  return 0;
}