Cod sursa(job #603881)

Utilizator ctlin04UAIC.VlasCatalin ctlin04 Data 19 iulie 2011 00:09:16
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.83 kb
Program text_3;
 var ch:char;
   s:set of char;
   k,l,m:longint;
   b1,b2: array [1..1 shl 16] of char;
   fi,fo:text;
begin
 assign(fi,'text.in');
  reset(fi);
 assign(fo,'text.out');
  rewrite(fo);
 settextbuf(fi,b1);
 settextbuf(fo,b2);
 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;
    if l<>0 then begin
                  inc(k);
                  m:=m+l;
                  end;
    writeln(fo,m div k);
   close(fo);
 end.