#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	char t[200000];
	char s[10];
	cin >> t;
	cin >> s;
	int n = strlen(t);
	int m = strlen(s);
	int k = 0,br=0;
	for (int i =0 ; i<n; i++)
		if (t[i] == 'a')
			k++;
	if(k>=m)
	{
		for (int i = 0; i < n; i++)
		{
			if (k == m-1) 
				break;
			if (t[i] == 'a') {
				t[i] = '*';
				k--;
				br++;
			}
		}
	}
	cout << br<<endl;
	cout << t;
}