#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int main() {
	string s, t;
	while (cin >> s >> t) {
		int ans = 0;
		rep(i, s.size()) {
			int minl = min(s.size() - i, t.size());
			int cnt = 0;
			rep(j, minl) {
				if (s[i + j] == t[j])cnt++;
				else { ans = max(ans, cnt); cnt = 0; }
			}
			ans = max(ans, cnt);
		}
		rep(i, t.size()) {
			int minl = min(s.size(), t.size() - i);
			int cnt = 0;
			rep(j, minl) {
				if (s[j] == t[i + j])cnt++;
				else { ans = max(ans, cnt); cnt = 0; }
			}
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
	return 0;
}