Cod sursa(job #291818)

Utilizator zseeZabolai Zsolt zsee Data 30 martie 2009 13:53:17
Problema Text Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.66 kb
program test;
var be,ki:text;
    nrcuvinte,lungcuvinte:longint;
    c:char;
    H,sep:set of char;

procedure kihagyasok;
begin
 if c in sep then inc(nrcuvinte);
 while (c in sep) do
  begin
   if eoln(be) then exit;
   read(be,c);
  end;
end;

begin
 h:=['A'..'Z','a'..'z'];
 sep:=[' ','-'];
 assign(be,'text.in');
 assign(ki,'text.out');
 reset(be);
 rewrite(ki);
 nrcuvinte:=0;
 lungcuvinte:=0;
 repeat
  read(be,c);
  if c in h then inc(lungcuvinte)
 until eoln(be);
 close(be);
 reset(be);
 kihagyasok;
 repeat
  read(be,c);
  if c in sep then kihagyasok
 until eoln(be);
 writeln(ki,lungcuvinte div nrcuvinte);
 close(ki);
end.