Cod sursa(job #291002)

Utilizator katamashCatalin Tamas katamash Data 29 martie 2009 10:59:36
Problema Text Scor 70
Compilator fpc Status done
Runda The Beginners Marime 0.65 kb
var x:char; c,l:real;
f:text; ok:boolean;
begin
assign(f,'text.in');reset(f);read(f,x);
c:=0;l:=0;ok:=false;
while not eof(f) do begin
      read(f,x);
      if (x in ['A'..'Z']) or (x in ['a'..'z']) or (x in ['0'..'9']) then
      if (x in ['A'..'Z']) or (x in ['a'..'z']) then begin l:=l+1; ok:=true; end
      else if ok=true then begin l:=l+1; c:=c+1; ok:=false; end
           else l:=l+1
         else if ok=true then begin c:=c+1; ok:=false; end;
       end;
if (x in ['A'..'Z']) or (x in ['a'..'z']) or (x in ['0'..'9']) then c:=c+1;
close(f);assign(f,'text.out');rewrite(f);
if c<>0 then write(f,trunc(l/c)) else write(f,0);
close(f);end.