#include <bits/stdc++.h>
using namespace std;

void transform(string& S, vector<pair<char, int>>& V) {
	char l = 0;
	int i = -1;
	for (const char& c : S) {
		if (c != l) {
			V.push_back({c, 1});
			i++;
			l = c;
		}
		else {
			V[i].second++;
		}
	}
}

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	string T, S;
	cin >> T >> S;

	if (T.length() < S.length()) {
		cout << 0 << endl;
		cout << T << endl;
		return 0;
	}

	vector<pair<char, int>> TV;
	vector<pair<char, int>> SV;

	transform(T, TV);
	transform(S, SV);

	int ans = 0;
	int offsetinstring = 0;
	for (size_t i = 0; i < TV.size() - SV.size() + 1; i++) {
		int tren = numeric_limits<int>::max();
		int trenindex = 0;
		int trenoffsetinstring = 0;
		int najoffsetinstring = 0;
		for (size_t j = 0; j < SV.size(); j++) {
			//cout << i << " " << j << "  " << TV[i + j].first << " " << TV[i + j].second << "   " << SV[j].first << " " << SV[j].second << endl;
			if (TV[i + j].first == SV[j].first) {
				int val = max(0, TV[i + j].second - SV[j].second + 1);
				if (val < tren) {
					tren = val;
					trenindex = i + j;
					najoffsetinstring = trenoffsetinstring;
				}
			}
			else {
				tren = 0;
				break;
			}
			trenoffsetinstring += TV[i + j].second;

		}
		// /cout << endl;

		for (int i = 0; i < tren; i++) {
			T[offsetinstring + najoffsetinstring + i] = '*';
		}
		offsetinstring += TV[i].second;
		ans += tren;
		//TV[trenindex].second -= tren;

	}
	cout << ans << endl;
	cout << T << endl;

	//for (const auto& a : TV) {
	//	cout << a.first << " " << a.second << endl;
	//}
	//cout << endl;
	//for (const auto& a : SV) {
	//	cout << a.first << " " << a.second << endl;
	//}
	return 0;
}