#include <iostream>

using namespace std;

int main() {
  for (;;) {
    string a, b;
    if (!(cin >> a)) return 0;
    cin >> b;
    int result = 0, dp[4001];
    fill(dp, dp+b.length()+1, 0);
    for (int i = 0; i < a.length(); i++)
      for (int j = b.length()-1; j >= 0; j--)
        if (a[i] == b[j]) {
          dp[j+1] = dp[j] + 1;
          if (dp[j+1] > result)
            result = dp[j+1];
        } else dp[j+1] = 0;
    cout << result << endl;
  }
}