#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define SQR(a) ((a)*(a))
using namespace std;
typedef long long int ll;
typedef pair<int,int> pr;
typedef pair<pr,ll> ppr;
typedef vector<pr> vpr;
const int INF=1<<30;
int DP[4001][4001]={};
int main() {
	string s1,s2;
	while(cin >>s1 >> s2){
		REP(i,4001)
			REP(j,4001)
				DP[i][j]=0;
	int maxim=0;
	REP(i,s1.size())
		REP(j,s2.size()){
				if(s1[i]==s2[j])
				DP[i+1][j+1]=DP[i][j]+1;
				maxim=max(maxim,DP[i+1][j+1]);
			}
	cout << maxim << endl;
	}
	// your code goes here
	return 0;
}