#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dec(x, y) fixed << setprecision((y)) << (x)
#define xx first
#define yy second
#define srt(v) sort((v).begin(), (v).end())
#define srtr(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define popb pop_back
#define sz(a) (int)(a).size()
#define len(a) (int)(a).length()
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

string t, s;
int n, m;
int dp[200002][12];
int main() {
    ios;
    cin >> t >> s;
    n=len(t); m=len(s);
    for(int j=0; j<m; j++) {
        for(int i=0; i<n; i++) {
            if(i==0) {
                dp[i][j]=(j==0&&t[0]==s[0]?1:0);
            }
            else {
                dp[i][j]=min((j==0?2000000000:dp[i-1][j-1]), dp[i-1][j]+(t[i]==s[j]));
            }
        }
    }
    for(int i=n-1, j=m-1; i>=0 && j>=0;) {
        if(t[i]==s[j]) {
            if((j==0?2000000000:(i==0?0:dp[i-1][j-1]))<(i==0?0:dp[i-1][j])+1) {
                i--, j--;
            }
            else {
                t[i]='*';
                i--;
            }
        }
        else {
            if((j==0?2000000000:(i==0?0:dp[i-1][j-1]))<(i==0?0:dp[i-1][j])) {
                i--, j--;
            }
            else {
                i--;
            }
        }
    }
    cout << dp[n-1][m-1] << "\n" << t;
    return 0;
}