Cod sursa(job #39912)

Utilizator anthraxztAndrei Tatar anthraxzt Data 27 martie 2007 09:05:59
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.49 kb
program whocares;
var f:text;
    n:longword=1;
    l:longword=0;
    c:char;
    abc:boolean=false;
    s:boolean;
begin
 assign(f,'text.in');reset(f);
 while not eof(f) do
  begin
   read(f,c);
   s:=false;
   case c of
    'a'..'z','A'..'Z':inc(l);
    ' ':begin s:=true; if abc then inc(n) else continue end
    else continue;
  end;
  abc:=c in ['A'..'Z','a'..'z'];
  end;
 close(f);
 if not s then inc(n);
 assign(f,'text.out');rewrite(f);
 write(f,l div n);
 close(f);
end.