Cod sursa(job #291769)

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

begin
 h:=['A'..'Z','a'..'z'];
 assign(be,'text.in');
 assign(ki,'text.out');
 reset(be);
 rewrite(ki);
 nrcuvinte:=1;
 lungcuvinte:=0;
 read(be,c);
 repeat
  if c=' ' then inc(nrcuvinte);
  while c=' ' do
   begin
    if eoln(be) then break
     else read(be,c);
   end;

  while c<>' ' do
   begin
    if c in h then inc(lungcuvinte);
    if eoln(be) then break
     else read(be,c);
   end

 until eoln(be);
 writeln(ki,lungcuvinte div nrcuvinte);
 close(ki);
end.