#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
	string s, t;
	while(cin >> s >> t){
		int n = s.size(), m = t.size(), ans = 0, c = 0;
		for(int i = 0; i < n; ++i){
			c = 0;
			for(int j = 0, k = i; j < m && k < n; ++j, ++k){
				if(s[k] == t[j]){
					c++;
				}
				else{
					ans = max(ans, c);
					c = 0;
				}
			}
            ans = max(ans, c);
		}
        
		for(int i = 0; i < m; ++i){
			c = 0;
			for(int j = 0, k = i; j < n && k < m; ++j, ++k){
				if(t[k] == s[j]){
					c++;
				}
				else{
					ans = max(ans, c);
					c = 0;
				}
			}
            ans = max(ans, c);
		}
		cout << ans << endl;
	}
	return 0;
}