#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const ll mod2=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=201000;
int n,m,dp[N][15];
char s[N],t[15],ans[N];
pair<PII,int> f[N][15];

void upd(int x,int y,int x1,int y1,int d) {
	if (y>=m||dp[x][y]<=dp[x1][y1]+d) return;
	dp[x][y]=dp[x1][y1]+d;
	f[x][y]=mp(mp(x1,y1),d);
}

void rec(int x,int y) {
	if (x<0||y<0) return;
	if (f[x][y].se) ans[x]='*';
	else ans[x]=s[x];
	rec(f[x][y].fi.fi,f[x][y].fi.se);
}

int main() {
	scanf("%s\n%s",s,t);
	n=strlen(s);
	m=strlen(t);
	rep(i,0,n) rep(j,0,m) dp[i][j]=1<<29,f[i][j]=mp(mp(-1,0),0);
	if (s[0]==t[0]) {
		dp[0][0]=1;
		f[0][0].se=1;
		dp[0][1]=0;
	} else {
		dp[0][0]=0;
	}
	rep(i,1,n) rep(j,0,m) {
		if (s[i]==t[j]) {
			upd(i,j+1,i-1,j,0);
			upd(i,j,i-1,j,1);
		} else {
			upd(i,j,i-1,j,0);
			upd(i,j,i-1,j,1);
		}
	}
	int q=0;
	rep(i,0,m) if (dp[n-1][i]<dp[n-1][q]) q=i;
	printf("%d\n",dp[n-1][q]);
	rec(n-1,q);
	printf("%s",ans);
}