#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string A,B;
    while(cin>>A>>B){
        int ans=0;
        if(A.size()<B.size())swap(A,B);
        for(int i=-(int)(B.size())+1;i<(int)A.size();i++){
            int cou=0;
            for(int j=0;j<B.size();j++){
                if(0<=i+j&&i+j<A.size()){
                    if(A[i+j]==B[j])cou++;
                    else cou=0;
                    ans=max(ans,cou);
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}