#include<iostream>
#include<string>

using namespace std;

int main(){

	string a, b, c;

	while(cin >> a, !cin.eof())
	{
		cin >> b;

		int res = 0;
		c = string(b.size(),'1');
		a = c + a;
		
		for(int i = 0; i < (int)a.size(); i++)
		{
//			cout << a << endl;
//			cout << b << endl;
			
			int ct = 0;
			
			for(int j = 0; j < min(a.size(), b.size()); j++)
			{
				if( a[j] == b[j] )
					res = max( ++ct, res );
				else
					ct = 0;
			}
			
			b = "2" + b;
//			cout << ct << endl;
		}
		
		cout << res << endl;
	}
	return 0;	
}