Cod sursa(job #262544)

Utilizator MihaiBunBunget Mihai MihaiBun Data 19 februarie 2009 14:25:41
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.9 kb
program llll;
var f,g:text;
    c:char;
    nr,sum,tip:longint;
begin
  assign(f,'text.in');
  reset(f);
  assign(g,'text.out');
  rewrite(g);
  nr:=0;
  sum:=0;
  tip:=0;
  while not eoln(f) do
    begin
      read(f,c);
      if (('a'<=c)and(c<='z'))or(('A'<=c)and(c<='Z')) then begin
                                                             sum:=sum+1;
                                                             if tip=0 then begin
                                                                              nr:=nr+1;
                                                                              tip:=1
                                                                            end;
                                                           end
                                                      else tip:=0;
    end;

    close(f);
    write(g,trunc(sum/nr));
    close(g);

end.