// I may fail a thousand times
// But there is no giving up
// IOI - here I come
#include <bits/stdc++.h>
using namespace std;
int dp[(int)2e5+5][15];
int nxt[(int)2e5+5][15];
signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);
	string s,t;cin>>s>>t;
	reverse(t.begin(),t.end());
	dp[s.length()][0]=0;
	for(int i=1;i<t.length();i++)dp[s.length()][i]=-1;
	for(int i=s.length()-1;i>=0;i--){
		dp[i][0]=s.length();
		for(int j=1;j<t.length();j++){
			if(dp[i+1][j-1]==-1){
				dp[i][j]=-1;
				nxt[i][j]=j-1;
				continue;
			}
			dp[i][j]=dp[i+1][j-1];
			nxt[i][j]=j-1;
		}
		for(int j=0;j<t.length();j++){
			if(dp[i+1][j]!=-1){
				if(dp[i+1][j]+(s[i]==t[j])<dp[i][j]){
					dp[i][j]=dp[i+1][j]+(s[i]==t[j]);
					nxt[i][j]=j;
				}
			}
		}
	}
	if(dp[0][t.length()-1]==-1){
		cout<<0<<'\n';
		cout<<s<<'\n';
		return 0;
	}
	cout<<dp[0][t.length()-1]<<'\n';
	int j=t.length()-1;
	for(int i=0;i<s.length();i++){
		if(dp[i][j]!=dp[i+1][nxt[i][j]]){
			cout<<'*';
		}else cout<<s[i];
		j=nxt[i][j];
	}
	cout<<'\n';
	return 0;
}