#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>

std::string s1,s2;

int dp[4001][4001];

int main() {
    
    while(std::cin>>s1>>s2) {
        
        std::memset(dp,0,sizeof(dp));
        
        for(int i=1;i<=s1.size();++i){
            for(int j=1;j<=s2.size();++j){
                if(s1[i-1]==s2[j-1])
                    dp[i][j]=dp[i-1][j-1]+1;
            }
        }
        
        int ans=0;
        
        for(int i=1;i<=s1.size();++i){
            for(int j=1;j<=s2.size();++j){
                ans=std::max(ans,dp[i][j]);
            }
        }
        
        std::cout<<ans<<std::endl;
    }
    
    return 0;
}