#include<iostream>
#include <cstring>
#include <string>
#include <string.h>
#include <algorithm>
using namespace std;

int main()
{
    string str,s2;
    //cout<<"Enter your String:";
    getline(cin,str);
    getline(cin,s2);
    int in,len=0;
    char sub_str[100][100]={0};
    for(in=0;str[in]!='\0';in++)
    {
        len++;
    }

    int i,min=999;

    int arr[256]={0};

    for(i=0;i<len;i++)
    {
        arr[str[i]]++;
    }

    char ch=' ';

    for (i =0; i <len; i++)
    {

    if(arr[str[i]]!=0)
        if (arr[str[i]]<=min)
        {
            min = arr[str[i]];
            ch = str[i];
        }

    }

    //cout<<"The Minimum occurring character in a string is "<<ch;
    int count;
if (s2.find(ch) != std::string::npos)
{
    std::replace( str.begin(), str.end(), ch, '*');
     count = std::count(str.begin(), str.end(), '*');
    std::cout<<count<<endl<<str;
}

return 0;

}