Cod sursa(job #291777)

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

begin
 h:=['A'..'Z','a'..'z','0'..'9'];
 assign(be,'text.in');
 assign(ki,'text.out');
 reset(be);
 rewrite(ki);
 nrcuvinte:=1;
 lungcuvinte:=0;
 repeat
  read(be,c)
 until 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,int(lungcuvinte / nrcuvinte):1:0);
 close(ki);
end.