Program echo;
Var
s1,s2:string;
i,j,k:longint;
l1,l2,max:longint;
o:boolean;
Begin
assign(input,'echo.in');
assign(output,'echo.out');
reset(input);
rewrite(output);
readln(s1);
readln(s2);
l1:=length(s1);
l2:=length(s2);
max:=0;
for i:=1 to l1 do begin
j:=1;
o:=true;
for k:=(l2-i+1) to l2 do begin
if s1[j]<>s2[k] then o:=false;
j:=j+1;
end;
if (o=true)and(i>max) then max:=i;
end;
for i:=1 to l2 do begin
j:=1;
o:=true;
for k:=(l1-i+1) to l1 do begin
if s2[j]<>s1[k] then o:=false;
j:=j+1;
end;
if (o=true)and(i>max) then max:=i;
end;
writeln(max);
close(input);
close(output);
End.