Cod sursa(job #39910)

Utilizator anthraxztAndrei Tatar anthraxzt Data 27 martie 2007 09:01:53
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.47 kb
program whocares;
var f:text;
    n:longword=1;
    l:longword;
    c:char;
    abc,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);
    ' ':if abc then begin s:=true;inc(n) end else continue;
    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.