Cod sursa(job #166019)

Utilizator monykMonica Ivan monyk Data 27 martie 2008 12:27:44
Problema Text Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.73 kb
program textu;
var f,g:text;
    x:char;
    l:array[0..100]of longint;
    a,ok,s,n,i:longint;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
while not(eof(f)) do
  begin
    read(f,x);
    l[n]:=l[n]+1;
    ok:=0;
      if (x=' ') then ok:=1;
      if (x='-') then ok:=1;
      if (x='_') then ok:=1;
      if (x=',') then ok:=1;
      if (x='.') then ok:=1;
      if (x='!') then ok:=1;
      if (x='?') then ok:=1;
      if (x=':') then ok:=1;
      if (x=';') then ok:=1;
      if (ok=1) then begin
                       l[n]:=l[n]-1;
                       n:=n+1;
                     end;
  end;
for i:=0 to n-1 do s:=s+l[i];
a:=s div n;
write(g,a);
close(f);
close(g);
end.