Cod sursa(job #140184)

Utilizator cristiz0neDadalau Alexandru cristiz0ne Data 21 februarie 2008 14:48:09
Problema Abc2 Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.7 kb
program alf;

type vec=array[1..500] of string[20];
var x:vec;
    a,s:string;
    n,i,tot:integer;
    f:text;

procedure citire;
var ok:boolean;
begin
assign(f,'abc2.in');
reset(f);
readln(f,a);
n:=0;
while not (eof(f)) do begin
      readln(f,s);
      ok:=true;
      for i:=1 to n do
               if x[i]=s then ok:=false;
      if ok=true then begin
         n:=n+1;
         x[n]:=s;
         end;
      end;
close(f);
end;

procedure afisare;
begin
assign(f,'abc2.out');
rewrite(f);
writeln(f,tot);
close(f);
end;

procedure prelucrare;
begin
tot:=0;
for i:=1 to n do
    if pos(x[i], a)<>0 then tot:=tot+1;
end;

begin
citire;
prelucrare;
afisare;
end.