#include <iostream>
#include <cmath>
using namespace std; 

int main()
{
    string s, t;
    cin>>t>>s;
    int n = t.length();
    int m = s.length();
    int br = 0;
    for (int i = 0; i<n; i++)
    {
    	if (t[i] == s[0])
    	{
    		t[i] = '*';
    		br ++;
		}
	}
	cout <<br<<endl<<t;
    
	return 0	;
    
}