using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace zad4._27._11._2021
{
    class pokazivaci
    {
        public string s,s1;
        public pokazivaci(string s,string s1)
        {
            this.s = s;this.s1 = s1;
        }
        public int PPZC(int n)
        {
            int b = 0,i;
            string s2 = s1.Substring(0,n);
            for(i=0;i<s.Length && b!=n;i++)
            {
                if(s[i]==s2[b])
                {
                    b++;
                }
            }
            if (b == n)
                return i;
            else
                return s.Length;
        }
        public int mincenzura(int n)
        {
            char c = s1[n - 1];
            int br = PPZC(n),b=0;
            for(int i=br;i<s.Length;i++)
            {
                if(s[i]==c)
                {
                    i++;
                    string p = "";
                    while(int.Parse(Convert.ToString(s[i]))>47 && int.Parse(Convert.ToString(s[i])) < 58)
                    {
                        p += s[i];i++;
                    }
                    b += int.Parse(p);
                }
            }
            return b;
        }
        public int resenje()
        {
            int min = mincenzura(1);
            for(int i=2;i<=s1.Length;i++)
            {
                if (min > mincenzura(i))
                    min = mincenzura(i);
            }
            return min;
        }
    }
    class Program
    {
        public static bool provera(string s)
        {
            for(int i=1;i<s.Length;i++)
            {
                if (s[i] != s[i - 1])
                    return false;
            }
            return true;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string z = Console.ReadLine();
            string s1 = s, s2="";
            bool homogeno = provera(z);
            if (z.Length==1)
            {
                s1 = s1.Replace(z[0], '*');
            }
            if(z.Length!=1 && homogeno)
            {
                int a = 0;
                for(int i=0;i<s1.Length;i++)
                {
                    if (z[0] == s[i])
                        a++;
                }
                for(int i=0;i<s1.Length && a>=z.Length;i++)
                {
                    if(s[i]==z[0])
                    {
                        a--;
                        s1 = s1.Remove(i, 1);
                        s1 = s1.Insert(i, "*");
                    }
                }
            }
            foreach(char c in s)
            {
                if(z.Contains(c)==false)
                {
                    s1.Replace(c, ' ');
                }
            }
            for(int i=1;i<s1.Length;i++)
            {
                int b = 1;
                while (i < s1.Length && s1[i]==s1[i-1])
                {
                    b++;i++;
                }
                s2 += Convert.ToString(s[i - 1]);
                s2 += Convert.ToString(b);
            }
            pokazivaci p = new pokazivaci(s2, z);
            Console.WriteLine(s1);
            Console.ReadLine();
        }
    }
}