using System;

namespace negyedikchas
{
    class Program
    {
        static void Main(string[] args)
        {
            string T, S;
            T = Console.ReadLine();
            S = Console.ReadLine();
            int N = T.Length;
            int i, j = 0, a = 0;
            char[] d = new char[N];
            char[] uj = new char[N];
            int[] z = new int[N];
            z[0] = 1;
            d[0] = T[0];

            for (i = 0; i < N - 1; i++)
            {

                if (T[i] == T[i + 1])
                {
                    z[j]++;
                }
                else
                {
                    j++;
                    z[j] = 1;
                    d[j] = T[i + 1];
                }
            }
            char b = d[0];
            int min = z[0];
            for (i = 0; i < j; i++)
            {
                if (min > z[i] && S.Contains(d[i]))
                {
                    min = z[i];
                    b = d[i];
                }
            }

            for (i = 0; i < uj.Length; i++)
            {

                if (T[i] == b)
                {
                    uj[i] = '*';
                }
                else
                {
                    uj[i] = T[i];
                }

            }
            Console.WriteLine(uj);
            Console.ReadKey();
        }
    }
}