var
a,b:string;
i,j,k,l,big,head,tail:integer;
begin
assign(input,'echo.in');reset(input);
assign(output,'echo.out');rewrite(output);
readln(a);
read(b);
big:=0;
for i:=1 to length(a) do
for j:=1 to length(b) do
if a[i]=b[j] then
begin
k:=1;
head:=i;
tail:=j;
while (a[head+1]=b[tail+1])and(head<length(a))and(tail<length(b))do
begin
inc(k);
inc(head);
inc(tail);
end;
if (i=1)or(tail=length(b)) then if k>big then big:=k;
end;
write(big);
close(input);
close(output);
end.