#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char in1[200] = { 0 }, in2[200] = { 0 }; gets(in1); gets(in2); int len1, len2; int i, j, t1, t2, k = 0; int max; int out[2000]; len1 = strlen(in1); len2 = strlen(in2); for (i = 0; i < len1; i++) { for (j = 0; j < len2; j++) { if (in1[i] == in2[j]) { int h = 0; for (t1 = i, t2 = j; in1[t1] == in2[t2] && t1 < len1 && t2 < len2; t1++, t2++) { h++; } out[k] = h; k++; } } } for (i = 0; i < k - 1; i++) { if (out[i] > out[i + 1]) { max = out[i]; out[i] = out[i + 1]; out[i + 1] = max; } } printf("%d", out[k - 1]); return 0; }