#include <stdio.h>
#include <string.h>

int main() {
    char s1[150], s2[150];
    int maxl = 0;
    while (scanf("%s\n%s", s1, s2) != EOF) {
        int len1 = strlen(s1);
        int len2 = strlen(s2);
        for (int i = 0; i < len1; i++) {
            for (int j = 0; j < len2; j++) {
                if (s1[i] == s2[j]) {
                    int tempmax = 0;
                    int k = 0;
                        while ((i + k < len1 )&&(j + k < len2)&&(s1[i + k] == s2[j + k])) {
                            k++;
                            tempmax++;
                        }

                    if (tempmax > maxl) maxl = tempmax;
                }
            }
        }
        printf("%d\n", maxl);
    }
    return 0;
}