Cod sursa(job #57829)

Utilizator gozmanGrosu Andrei Nicolae gozman Data 3 mai 2007 09:25:10
Problema Text Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.66 kb
program text1;
var f:text;
    nrc,l,lc:longint;
    x:char;
    begin
    assign(f,'text.in'); reset(f);
    while not eof(f) do
    begin
         read(f,x);
         if ((x in ['a'..'z'])
              or (x in ['A'..'Z']))
              then begin
                        lc:=lc+1;
                        if lc=1 then nrc:=nrc+1;
                   end
              else if lc<>0 then
                             begin
                                     l:=l+lc;
                                     lc:=0;
                             end;
 end;
 close(f);
 assign(f,'text.out'); rewrite(f);
 writeln(f,int(l/nrc):0:0);
 close(f);
 end.