#include <iostream>
#include <string>

using namespace std;

int main(){
	string S, T;
	int M, L, low, s;
	
	cin >> T;
	cin >> S;
	M = S.length();
	L = T.length();
	
	int a[M+1];
	
	a[0] = 2;
	int i = 0;
	
	for (i; i < M + 1; i++){
		a[i] = 1;
	}
	
	i = 0;
	int j = 0;
	
	for (i; i < L + 1; i++){
		if (T[i] == T[i+1]){
			a[j]++;
		}else{
			j++;
		}
	}
	
	low = 0;
	i = 0;
	for (i; i < M + 1; i++){
		if (a[low] >= a[i]){
			low = i;
		}
	}
		
	s = 0;
	i = 0;
	for (i; i < low; i++){
		s += a[i];
	}
	
	i = 0;
	for (i; i>0 ){
		if 
			T.replace(s,a[low],"*");
	}
	cout << low << endl;
	cout << a[low] << endl;
	cout << T << endl;
}