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

#define endl '\n'
#define ll long long
#define NMAX (int)1e6
#define vi vector<int>
#define pii pair<int,int>
#define w(x) cout<<#x<<':'<<x<<endl;
#define PB push_back
#define juseinbolt ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void solve3(string s1,string s2)
{
    int cA=0, cB=0;
    int best=s1.size()+5, index=-1;
    for(auto c:s1)
    {
        cA+=(c=='a');
        cB+=(c=='b');
    }
    int cAL=0, cBD=cB;
    for(int i=0; i<s1.size(); ++i)
    {
        int c=s1[i];
        if(c=='a')
        {
            int x=cBD+cAL;
            if(x<best)
            {
                best=x;
                index=i;
            }
            cAL++;
        }
        else if(c=='b')
        {
            cBD--;
            int x=cBD+cAL;
            if(x<best)
            {
                best=x;
                index=i;
            }
        }
    }
    if(index==-1) best=0;
    else
    {
        for(int i=0; i<index; ++i)
        {
            if(s1[i]=='a') s1[i]='*';
        }
        for(int i=index+1; i<s1.size(); ++i)
        {
            if(s1[i]=='b') s1[i]='*';
        }
    }
    cout<<best<<endl<<s1<<endl;
    exit(0);
}
void solve12(string s1,string s2)
{
    int cnt=0;
    int ans;
    for(auto c:s1) if(c=='a') cnt++;
    if(cnt<s2.size())
    {
        ans=0;
    }
    else
    {
        ans=cnt-(s2.size()-1);
        for(int i=0, j=0; i<s1.size(), j<ans; ++i)
        {
            if(s1[i]=='a')
            {
                s1[i]='*';
                j++;
            }
        }
    }
    cout<<ans<<endl<<s1;
    exit(0);
}
void solveO(string s1,string s2)
{

    exit(0);
}

int main()
{
    juseinbolt;

    string s1,s2;
    cin>>s1>>s2;

    if(s2=="ab") solve3(s1,s2);
    else {
        for(auto c:s2) if(c!='a') solveO(s1,s2);
    }
    solve12(s1,s2);
    return 0;
}