Cod sursa(job #601338)

Utilizator ion824Ion Ureche ion824 Data 5 iulie 2011 22:53:07
Problema Text Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.65 kb
Program texte;
   var ch:char;
       suma,cuvinte:longint;
       f:text;
begin
  assign(f,'text.in'); reset(F); read(f,ch);
  suma:=0; cuvinte:=0;
  while not eof(f) do begin
         read(f,ch);
         if  ((ch>='A')and(ch<='Z'))or((ch>='a')and(ch<='z')) then
            begin
              inc(cuvinte);
              while ((ch>='A')and(ch<='Z'))or((ch>='a')and(ch<='z')) do
                    begin
                      inc(suma);
                      read(f,ch);
                    end;
            end;
                       end;

    close(f); assign(f,'text.out'); rewrite(f);
    writeln(f,suma div cuvinte); close(f);
    end.