#include <bits/stdc++.h>
using namespace std;

int main() {
    string s, t;
    long int brA, brB, brC;
    brA = brB = brC = 0;
    cin>>t;
    cin>>s;
    
    if (s[0] == 'a' && s[1] != 'b') {
        for (long int i=0;i<t.size();i++)
            if (t[i] == 'a') brA++;
        printf("%ld\n", brA);
        for (long int i=0;i<t.size();i++) {
            if(t[i]=='a') printf("*");
            else printf("%c", t[i]);
        }
    }
    
    if (s[0] == 'a' && s[1] == 'b' && s[2] != 'c') {
        for (long int i=0;i<t.size();i++) {
            if (t[i] == 'a') brA++;
            if (t[i] == 'b') brB++;
        }
        if (brA <= brB) {
            printf("%ld\n", brA);
            for (long int i=0;i<t.size();i++) {
                if(t[i]=='a') printf("*");
                else printf("%c", t[i]);
            }
        } else {
            printf("%ld\n", brB);
            for (long int i=0;i<t.size();i++) {
                if(t[i] == 'b')printf("*");
                else printf("%c", t[i]);
            }
        }
    }
    
    if (s[0] == 'a' && s[1]=='b' && s[2]=='c') {
        for (long int i=0;i<t.size();i++) {
            if (t[i] == 'a') brA++;
            if (t[i] == 'b') brB++;
            if (t[i] == 'c') brC++;
        }
        if (brA <= brB && brA <= brC) {
            printf("%ld\n", brA);
            for (long int i=0;i<t.size();i++) {
                if(t[i]=='a') printf("*");
                else printf("%c", t[i]);
            }
        } else if (brB <= brA && brB <= brC) {
            printf("%ld\n", brB);
            for (long int i=0;i<t.size();i++) {
                if(t[i] == 'b')printf("*");
                else printf("%c", t[i]);
            }
        } else {
            printf("%ld\n", brC);
            for (long int i=0;i<t.size();i++) {
                if(t[i] == 'c')printf("*");
                else printf("%c", t[i]);
            }
        }
    }
}