#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char *result;
    char T[2000000];
    char S[20];
    int tipCount[256];
    scanf("%s", T);
    scanf("%s", S);
    int currentRep=0;
    int min=50;
    int minIndex=0;
    int a=0;
    int b=0;

    int found=0;

    while(a<200000 && T[a]!='\0' && b<10 && S[b]!='\0'){
        if(S[b+1]=='\0') found=1;
        if(T[a]==S[b]){
            currentRep++;
        }
        else{
            if(currentRep<min){
                min=currentRep;
                minIndex=a-1;
            }
            currentRep=0;
            if(T[a]==S[b+1]){
                b++;
                a--;
            }
            else{
                min=200000;
                b=0;
            }
        }
        a++;
    }
    if(found){
            for(int i=0;i<min;i++){
                printf("%d\n", min);
                T[minIndex-i]='*';
            }

    }
    printf("%s",T);
    return 0;
}