#include <iostream>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

string s, t;
int dp[4001][4001];

int main(){
	while(cin >> s >> t){
		rep(i, s.size() + 1){
			dp[i][0] = 0;
		}
		rep(i, t.size() + 1){
			dp[0][i] = 0;
		}
		for(int i = 1; i <= s.size(); ++i){
			for(int j = 1; j <= t.size(); ++j){
				dp[i][j] = s[i - 1] == t[j - 1] ? dp[i - 1][j - 1] + 1 : 0;
			}
		}
		int ans = 0;
		rep(i, s.size() + 1){
			ans = max(*max_element(dp[i], dp[i] + t.size() + 1), ans);
		}
		cout << ans << endl;
	}
	return 0;
}