#include <bits/stdc++.h>
using namespace std;
//Zadatak: Cen*ura


int main(){
	string t, s;
	cin >> t;
	cin >> s;

	if (s=="a")
	{
		int br_a=count(t.begin(), t.end(), 'a');
		cout << br_a << endl;
		std::replace(t.begin(), t.end(), 'a', '*');
		cout << t ;
		return 0;
	}
	else //RESAVA BROJ *
	{
		int count = 0;
		unsigned int nPos = 0;
		while((unsigned int)(nPos = t.find(s, nPos)) != (unsigned int)std::string::npos)
		{
			count++; nPos += s.size();
		}

		cout << count << endl;


		vector<int> indexi;
		int pos=t.find(s, 0);
		while(pos != string::npos)
		{
			indexi.push_back(pos);
			pos = t.find(s, pos+1);
		}

       	vector<char> v;
       	for (int i = 0; i < t.size(); i++)
       	{
       		if (std::find(indexi.begin(), indexi.end(), i) != indexi.end()) v.push_back('*');
       		else v.push_back(t[i]);
       	}

       	for (int i = 0; i < v.size(); i++)
       	{
       		cout << v[i] ;
       	}
	}

	return 0;

}