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

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string r = Console.ReadLine();
            string s = Console.ReadLine();
            int[] a = new int[s.Length];
            int min = int.MinValue, imin = 0;
            int x = 0;
            for(int i = 0; i < s.Length; i++)
            {
                int br = 0;
                for(int j = 0; j < r.Length; j++)
                {
                    if (s[i] == r[j]) br++;
                    a[i] = br;
                }
            }
            for(int i = 0; i < s.Length; i++)
            {
                if(a[i] < min)
                {
                    min = a[i];
                    imin = i;
                }
            }
            for (int i = 0; i < r.Length; i++) if (r[i] == s[imin]) x++;

            Console.WriteLine(imin);
            for(int i = 0; i < r.Length; i++)
            {
                if (r[i] == s[a[x]]) Console.Write("*");
                else Console.Write(r[i]);
            }
        }
    }
}