Cod sursa(job #98423)

Utilizator lucaz0rLuca Liviu lucaz0r Data 10 noiembrie 2007 13:20:01
Problema Abc2 Scor 0
Compilator fpc Status done
Runda Happy Coding 2007 Marime 0.82 kb
program happy1;
type vector=array [1..2500] of string[20] ;
var f,g:text;
    x,i,p:longint;
    j:char;
    a:vector;
    n,test:string[21];
function abc(n:string):boolean;
begin
   abc:=false;
  for i:=1 to x do
   if n = a[i] then  begin
                     abc:=true;
                     break;
                     end;
end;
begin
  assign (f,'abc2.in');
  reset (f);
  readln (f);
  x:=0;
  while not eof(f) do
   begin
      inc(x);
     readln (f,a[x]);
   end;
 reset(f);
 test:='';
 for i:=1 to length(a[1]) do
  begin
    read (f,j);
    test:=test+j;
  end;
  p:=0;
 while NOT EOLN(F) do
   begin
     if abc(test) then inc(p);
     delete(test,1,1);
     read(f,j);
     test:=test+j;
  end;
 close (f);
assign (g,'abc2.out');
rewrite(g);
writeln (g,p);
close (g);
end.