Pagini recente » Cod sursa (job #2934367) | Cod sursa (job #2934355) | Cod sursa (job #917302) | Cod sursa (job #2055211) | Cod sursa (job #104847)
Cod sursa(job #104847)
type pelem=^elem;
elem=record
info:string[21];
next:pelem;
end;
var last:pelem;
fi,fo:text;
cont,i,ct3,lung:longint;
cuvant:string[21];
procedure ins(var first:pelem; vl:string[21]);
var p:pelem;
begin
if first=nil then
begin
new(first);
first^.info:=vl;
first^.next:=nil;
last:=first;
end
else
begin
new(p);
p^.info:=vl;
p^.next:=nil;
last^.next:=p;
last:=p;
end;
end;
function cauta(first:pelem; vl:string[21]):boolean;
var p:pelem;
begin
p:=first;
while p<>nil do
begin
if p^.info=vl then begin cauta:=true; exit; end;
p:=p^.next;
end;
cauta:=false;
end;
procedure print(first:pelem);
var p:pelem;
begin
p:=first;
while p<>nil do
begin
writeln(fo,p^.info);
p:=p^.next;
end;
end;
var sir:ansistring;
cuv:string[21];
a:pelem;
begin
assign(fi,'abc2.in'); reset(fi);
assign(fo,'abc2.out'); rewrite(fo);
readln(fi,sir);
while not eof(fi) do
begin
readln(fi,cuv);
ins(a,cuv); end;
ct3:=length(sir); lung:=length(cuv); cont:=0;
for i:=1 to ct3-3 do
begin
cuvant:=copy(sir,1,lung);
if cauta(a,cuvant) then inc(cont);
delete(sir,1,1);
end;
writeln(fo,cont);
close(fi);
close(fo);
end.