program echo;
var
s1,s2:string;
i,j,n,m,l1,l2,a1,a2:integer;
begin
assign(input,'echo.in');
assign(output,'echo.out');
reset(input); rewrite(output);
readln(s1);
readln(s2);
l1:=length(s1);
l2:=length(s2);
n:=0;
for i:=1 to l1 do begin
for j:=1 to l2 do begin
a1:=i; a2:=j; m:=0;
while (s1[a1]=s2[a2])and(a1<=l1)and(a2<=l2) do begin
inc(a1); inc(a2);
inc(m);
end;
if m>n then n:=m;
end;
end;
writeln(N);
close(input); close(output);
end.