#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

int dp[4001][4001];

int main(){
    
    string s, t;

    while(cin >> s >> t){
        memset(dp, -1, sizeof(dp));
        dp[0][0] = (s[0] == t[0]);
        for(int i = 1; i < s.size(); i++){
            for(int j = 1; j < t.size(); j++){
                if(s[i] == t[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
                else dp[i][j]  = 0;
            }
        }
        int maxi = 0;
        for(int i = 0; i < s.size(); i++){
            maxi = max(maxi, *max_element(dp[i], dp[i] + t.size()));
        }
        cout << maxi << endl;
    }
}