Cod sursa(job #291821)

Utilizator zseeZabolai Zsolt zsee Data 30 martie 2009 14:00:54
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.8 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);
 read(be,c);
 while (c in sep) do
  begin
   if eoln(be) then break;
   read(be,c);
  end;
 repeat
  read(be,c);
  if c in sep then kihagyasok
 until eoln(be);
 if not(c in sep) then inc(nrcuvinte);
 writeln(ki,lungcuvinte div nrcuvinte);
 close(ki);
end.