#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const int mxN = 2e5+5;
const int mod = 1e9+7;
const int mxlogN = 20;
const int mxK = 10;

int dp[mxK][mxN];
pair<int, int> nex[mxK][mxN];
bool done[mxK][mxN];

int solve(int i, int j, string& s, string& t)
{
    if(i==s.size()) return 0;
    if(done[j][i]) return dp[j][i];
    done[j][i] = 1;
    if(s[i]!=t[j])
    {
        nex[j][i] = {i+1, j};
        return dp[j][i] = solve(i+1, j, s, t);
    }
    auto ans = 1+solve(i+1, j, s, t);
    nex[j][i] = {i+1, j};
    if(j+1!=t.size())
    {
        int ans2 = solve(i+1, j+1, s, t);
        if(ans2 < ans)
        {
            ans = ans2;
            nex[j][i] = {i+1, j+1};
        }
    }
    return dp[j][i] = ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s, t; cin >> s >> t;
    cout << solve(0, 0, s, t) << "\n";
    int j = 0;
    int n = s.size();
    for(int i = 0; i < n; i++)
    {
        int j2 = nex[j][i].second;
        if(j2==j && s[i]==t[j]) cout << "*";
        else cout << s[i];
        j = j2;
    }
    cout << "\n";
}