#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define en '\n'
#define sp ' '
#define tb '\t'
#define ri(n) int n; cin >> n
#define rl(n) ll n; cin >> n
#define rs(s) string s; cin >> s
#define rc(c) char c; cin >> c
#define rv(v) for (auto &x : v) cin >> x
#define pven(v) for (auto x : v) cout << x << en
#define pv(v) for (auto x : v) cout << x << sp; cout << en
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout << "YES" << en
#define no cout << "NO" << en
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define ssort(a, b) if (a < b) swap(a, b)
#define bitcnt(a) __builtin_popcountll(a)
#define bithigh(a) 63-__builtin_clzll(a)
#define lg bithigh
ll highpow(ll a) { return 1LL << (ll)lg(a); }

using namespace std;

const ll LINF = 4e18;
const int mxN = 2e5+10, INF = 2e9, mod = (1 ? 1e9+7 : 998244353);
ll n, m;
array<ll, 4> dp[mxN][12];

void minimize(int i1, int j1, int i2, int j2, int take){

    if (dp[i1][j1][0] + take < dp[i2][j2][0])
        dp[i2][j2] = {dp[i1][j1][0] + take, i1, j1, take};
}

void Solve(){

    rs(T); rs(S);
    n = T.size();
    m = S.size();
    for (int i = 0; i < n; i++)
        for (int j = 0; j <= m; j++)
            dp[i][j][0] = LINF;
    dp[0][0] = {T[0]^S[0] ? 0 : 1, -1, -1, T[0]^S[0] ? 0 : 1 };
    if (T[0] == S[0]) dp[0][1] = { 0, -1, -1, 0 };
    for (int i = 0; i < n - 1; i++){
        for (int j = 0; j <= m; j++){
            if (j < m && T[i+1] == S[j]){
                minimize(i, j, i+1, j+1, 0);
                minimize(i, j, i+1, j, 1);
            }
            else
                minimize(i, j, i+1, j, 0);
        }
    }
    array<ll, 2> ans = {LINF, -1};
    for (int i = 0; i < m; i++)
        if (dp[n-1][i][0] < ans[0])
            ans = {dp[n-1][i][0], i};
    int i = n-1, j = ans[1];
    while (~i){
        if (dp[i][j][3]) T[i] = '*';
        array<int, 2> t = {dp[i][j][1], dp[i][j][2]};
        i = t[0]; j = t[1];
    }
    cout << ans[0] << en << T << en;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0); cerr.tie(0);
    cout << setprecision(12) << fixed;
    cerr << setprecision(12) << fixed;
    cerr << "Started!" << endl;

    int t = 1;
    //cin >> t;
    while (t--)
        Solve();

    return 0;
}