Pagini recente » Cod sursa (job #2183923) | Cod sursa (job #1995370) | Cod sursa (job #1175675) | Cod sursa (job #788573) | Cod sursa (job #98995)
Cod sursa(job #98995)
var nr,ls,a:integer;
c:array[1..10000000]of char;
b:array[1..50000]of string;
f,g:text;
i,j,li,n:longint;
y:string;
ok:boolean;
begin
assign(f,'abc2.in');
assign(g,'abc2.out');
reset(f);
rewrite(g);
begin {citire text}
li:=1;
while not(eoln(f))do begin
read(f,c[li]);
inc(li);
end;
end;
begin {citire cuvinte}
n:=li;
li:=1;
while not(eof(f))do begin
readln(f,y);
ok:=true;
for i:=1 to li-1 do
if y=b[i] then begin ok:=false; break;end;
if ok= true then begin b[li]:=y;
inc(li); end;
end;
end;
ls:=length(y);
begin {partea grea}
for i:=1 to li do begin
for j:=2 to n-ls do begin
if b[i][1]=c[j]then begin
ok:=true;
for a:=2 to ls do begin
if b[i][a]<>c[j+a-1] then begin ok:=false; break; end;
end;
if ok=true then inc(nr);
end;
end;
end;
end;
writeln(g,nr);
readln;
close(f);
close(g);
end.