using System;
using System.Text;
class Program{
    public static void Main(){
        string t = Console.ReadLine();
        string s = Console.ReadLine();
        StringBuilder cenzurisan = new StringBuilder(t);
        int brojac = 0;
        int brojacA = 0;
        for(int i = 0; i<t.Length; i++){
            if(t[i] == 'a'){
                brojacA++;
                if(brojacA > s.Length){
                    cenzurisan[i] = '*';
                    brojac++;
                }
            }
        }
        Console.WriteLine(brojac);
        Console.WriteLine(cenzurisan.ToString());
    }
}