#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
	string a, b;
	while (cin >> a >> b) {
		int MAX = 0;
		for (int i = 0; i < a.size(); i++) {
			int c = 0;
			for (int j = 0; j < b.size(); j++) {
				if (i+j < a.size()) {
					if (a[i+j] == b[j]) {
						c++;
					} else {
						MAX = max(MAX, c);
						c = 0;
					}
				} else {
					MAX = max(MAX, c);
					break;
				}
			}
		}
		for (int i = 0; i < b.size(); i++) {
			int c = 0;
			for (int j = 0; j < a.size(); j++) {
				if (i+j < b.size()) {
					if (b[i+j] == a[j]) {
						c++;
					} else {
						MAX = max(MAX, c);
						c = 0;
					}
				} else {
					MAX = max(MAX, c);
					break;
				}
			}
		}
		cout <<MAX << endl;
	}
	return 0;
}