Cod sursa(job #536833)

Utilizator nimenicamineTomus Madalina nimenicamine Data 19 februarie 2011 15:28:29
Problema Text Scor 70
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.72 kb
program mml;
var c:char;
    c2,nr,contor:integer;
    lung:real;
    ok,ok1:boolean;
    f,g:text;
begin
assign(f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
contor:=0;
nr:=0;
  While not seekeof(f) do
    begin
    ok:=false;
      read(f,c);
        If ((c>='a') and (c<='z')) or ((c>='A') and (c<='Z')) then
          begin
          ok:=true;
          contor:=contor+1;
          c2:=0;
          end;
        If (ok=false) and (contor<>0) then
          begin
          c2:=c2+1;
            If c2=1 then
               nr:=nr+1;
          end;
    end;
    if c2<>0 then
      lung:=contor/nr
    else
lung:=contor/(nr+1);

writeln(g,trunc(lung));
  close(f);
  close(g);
end.