#include <iostream>
#include <string.h>
using namespace std;
short dp[4001][4001];
int main(){
  string s,t;


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