using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool g = false;
            int min = -1, c = 0, d = 0, j = 0;
            string s = "";
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == b[j])
                {
                    c++;
                }
                else if (a[i] == b[j == b.Length - 1 ? 0 : j + 1])
                {
                    j++;
                    if (min == -1)
                    {
                        min = c;
                        d = c;
                        s = a.Remove(i - c, c);
                        for (int k = 0; k < c; k++)
                        {
                            s = s.Insert(i - c, "*");
                        }
                    }
                    else if (c < min)
                    {
                        min = c;
                        d = c;
                        s = a.Remove(i - c, c);
                        for (int k = 0; k < c; k++)
                        {
                            s = s.Insert(i - c, "*");
                        }
                    }
                    if (j == b.Length)
                    {
                        j = 0;
                        g = true;
                    }
                    c = 1;
                }
                else c = 1;
            }
            if (j == b.Length - 1) g = true;
            if (a[a.Length - 1] == b[j])
            {
                if (min == -1)
                {
                    min = c;
                    d = c;
                    s = a.Remove(a.Length - c, c);
                    for (int k = 0; k < c; k++)
                    {
                        s = s.Insert(a.Length - c, "*");
                    }
                }
                else if (c < min)
                {
                    min = c;
                    d = c;
                    s = a.Remove(a.Length - c, c);
                    for (int k = 0; k < c; k++)
                    {
                        s = s.Insert(a.Length - c, "*");
                    }
                }
            }
            if (!g)
            {
                s = a;
                d = 0;
            }
            Console.WriteLine(d);
            Console.WriteLine(s);
        }
    }
}