#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)
#define INF 1 << 28
typedef pair<int,int> Pi;
#define F first
#define S second
#define pb push_back

inline void chmax(int &a, int b) { a = max(a,b); }
inline void chmin(int &a, int b) { a = min(a,b); }

int main()
{
  string s, t;
  while(cin >> s >> t) {
    vector<vector<int> > dp(2,vector<int>(4005,0));
    int ss = s.size(), ts = t.size();
    int maxv = 0;
    Rep(i,ts) {
      Rep(j,ss) {
	if(s[j] == t[i]) {
	  dp[1][j + 1] = dp[0][j] + 1;
	  chmax(maxv,dp[1][j + 1]);
	}else {
	  dp[1][j + 1] = 0;
	}
      }
      dp[0] = dp[1];
    }
    cout << maxv << endl;
  }
  return 0;
}