Pagini recente » Cod sursa (job #586748) | Cod sursa (job #2090458) | Cod sursa (job #1375887) | Cod sursa (job #2504487) | Cod sursa (job #549220)
Cod sursa(job #549220)
var i,j,nr,n1,n2:longint;
f1,f2:text;
a,b:array[0..100000]of char;
ok:boolean;
begin
assign(f1,'strmatch.in');
reset(f1);
assign(f2,'strmatch.out');
rewrite(f2);
n1:=0;
n2:=0;
while not eoln(f1) do
begin
inc(n1);
read(f1,a[n1]);
end;
reset(f1);
readln(f1);
while not eoln(f1) do
begin
inc(n2);
read(f1,b[n2]);
end;
nr:=0;
for i:=1 to n2 do
begin
if b[i]=a[1] then
begin
ok:=true;
for j:=1 to n1 do
if a[j]<>b[i+j-1] then begin ok:=false; break; end;
if ok then inc(nr);
end;
end;
writeln(f2,nr);
close(f1);
close(f2);
end.