import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        String tekst = scanner.nextLine();
        String newText = "";
        String badWord = scanner.nextLine();
        int badWordCount = 0;
        for(int i = 0; i < tekst.length()-1;i++)
        {
            char currentChar = tekst.charAt(i);
            if(currentChar == tekst.charAt(i+1))
            {
                int counter = i;
                while(currentChar == tekst.charAt(counter+1) && counter + 2 < tekst.length())
                {
                    counter++;
                }
                i = counter;
                newText += currentChar;
            }
            else
            {
                newText += currentChar;
            }
        }
        for(int i =0 ; i < newText.length()-1;i++)
        {
            char firstChar = badWord.charAt(0);
            char lastChar = badWord.charAt(badWord.length()-1);
            char currentChar = newText.charAt(i);
            if(currentChar == firstChar)
            {
                int counter = i;
                while(newText.charAt(counter) != lastChar)
                {
                    counter++;
                    i = counter;
                }
                badWordCount++;
            }
        }
        ArrayList<String> parts = splitStringByCharacter(tekst);
        for(int i= 0; i < parts.size();i++)
        {
            char currentChar = parts.get(i).charAt(0);
            if(currentChar == badWord.charAt(0))
            {
                boolean isTrue = true;
                for(int j = 0; j < badWord.length();j++)
                {
                    if (parts.get(j+i).charAt(0) == badWord.charAt(j))
                    {
                    }
                    else
                    {
                        isTrue = false;
                        break;
                    }
                }
                if(isTrue)
                {
                    int smallestIndex = 0;
                    int length = 10000000;
                    for(int j = 0; j < badWord.length();j++)
                    {
                        if(parts.get(i+j).length() < length)
                        {
                            length = parts.get(i+j).length();
                            smallestIndex = i+j;
                        }
                    }
                    String newWord = "";
                    for(int j = 0; j < parts.get(smallestIndex).length();j++)
                    {
                        newWord += "*";
                    }
                    parts.set(smallestIndex,newWord);
                }
            }
        }
        String textNew = "";
        System.out.println(badWordCount);
        for(int i = 0 ;i < parts.size();i++)
        {
            textNew += parts.get(i);
        }
        System.out.println(textNew);
    }

    public static ArrayList<String> splitStringByCharacter(String string){

        ArrayList<String> resultStrings = new ArrayList<>();
        StringBuilder currentString = new StringBuilder();

        for (int pointer = 0; pointer < string.length(); pointer++){

            currentString.append(string.charAt(pointer));

            if (pointer == string.length() - 1
                    || currentString.charAt(0) != string.charAt(pointer + 1)) {
                resultStrings.add(currentString.toString());
                currentString = new StringBuilder();
            }
        }

        return resultStrings;
    }
}