#include <iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>









int main(int argc, char** argv)
 {
 	ios_base::sync_with_stdio(false);
cin.tie(NULL); 

string s;
cin>>s;

string m;
cin>>m;

int b=0;
if(m=="a")
{
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='a')
		{
			b++;
			s[i]='*';
		}
		
	}
	
	cout<<b<<endl;
	cout<<s;
	
}



     
	 
	 
	 
	 
	 
  
   
  
}