Pagini recente » Cod sursa (job #3183806) | Rating Andrei Georgescu (lameboy) | Cod sursa (job #3284083) | Profil careizoli | Cod sursa (job #22591)
Cod sursa(job #22591)
var f,g:text;
a,b,x:string;
e,w,i,j,k,q:shortint;
begin
assign(f,'subsir.in');
reset(f);
readln(f,a);
readln(f,b);
close(F);
if length(a)<length(b) then begin x:=b; b:=a; a:=x; end;
e:=0;
q:=0;
for i:=1 to length(a) do
for j:=1 to length(b) do
begin
k:=0;
if a[i]=b[j] then
repeat
inc(k);
until b[i+k]<>a[i+k];
if k>q then begin q:=k; e:=0; i:=i+k;end;
if (k=q) and (k<>0) then inc(e);
end;
assign(g,'subsir.out');
rewrite(g);
writeln(g,e);
close(g);
end.