#include <string.h>
// 暴力
// 遍历 字符串max = len max--,匹配strncp strstr 匹配到结束

int main()
{
    char str1[200] = {'\0'}, str2[200] = {'\0'};
    scanf("%s\n%s",str1,str2);
    int max = strlen(str1);
    
    int flag = 0;
    for (int i = max; i >0; i--)
    {
        for (int j = 0; j <= strlen(str1) - i; j++)
        {
            char cmpstr[200] = "\0";
            strncpy(cmpstr, str1 + j, i);
            if (strstr(str2, cmpstr) != NULL)
            {
                flag = 1;
                max = i;
                break;
            }
        }
        if(flag)
        break;
    }

if(flag==1){
    max = max;
}
else 
max =0;

printf("%d\n",max);

    return 0;
}