#include <bits/stdc++.h>
using namespace std;
int main()
{
	string gas, plin;
	cin >> gas>>plin;
	string cepelin = "";
	int b = 0;
	for (int i = 0; i < gas.size(); i++)
	{
		if(gas[i]=='a')
		b++;
		if(b>=plin.size() && gas[i]=='a')
		cepelin+="*";
		else cepelin+=gas[i];
	}
	cout << b-plin.size()+1 << endl;
	cout << cepelin;
	return 0;
}