Cod sursa(job #601348)

Utilizator ctlin04UAIC.VlasCatalin ctlin04 Data 5 iulie 2011 23:25:48
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.65 kb
Program text_3;
 var ch:char;
   s:set of char;
   k,l,m:longint;
   fi,fo:text;
begin
 assign(fi,'text.in');
  reset(fi);
 assign(fo,'text.out');
  rewrite(fo);
 s:=['a'..'z','A'..'Z']; m:=0; k:=0;
 while not eof(fi) do begin
  read(fi,ch);
  if ch in s then inc(l)
   else
    if (ch in [chr(0)..chr(127)]-s) and (l>0) then begin
                                                   inc(k);
                                                    m:=m+l;
                                                       l:=0;
                                                      end;
                       end;
    writeln(fo,m div k);
   close(fo);
 end.