#include <iostream>
#include <list>
#include <string>

using namespace std;

int main()
{
	string s, rec;
	
	cin>>s>>rec;
	
	if(rec == "ab")
	{
		
	}
	//pretpostavicu da je rec oblika "aaa...aa"
	else
	{
		int count = 0;
		for(int i=0;i<s.length();i++)
			if(s[i]=='a')
				count++;
		cout<<count-rec.length()+1<<endl;
		
		int mem = count-rec.length()+1;
		count = 0;
		for(int i=0;i<s.length();i++)
		{
			if(s[i]=='a' && count<mem)
			{
				cout<<"*";
				count++;
			}
			else
				cout<<s[i];
		}
	}
	
    return 0;
}