Cod sursa(job #83966)

Utilizator toni2007Pripoae Teodor Anton toni2007 Data 12 septembrie 2007 20:47:06
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.49 kb
var s,x,y,i,j:longint;
    f1,f2:text;
    c:char;
begin
     Assign(f1,'text.in');reset(f1);
     Assign(f2,'text.out');rewrite(f2);
     x:=0;j:=0;s:=0;i:=0;
     while not eof(f1) do begin
     read(f1,c);
     i:=i+1;
     if c=' '
            then begin
            s:=s+i-x;
            j:=j+1;
            If y=0 then y:=i;
            x:=y;
            y:=i;
     end;
     end;
     s:=s+i-x;
     j:=j+1;
     writeln(f2,s div j);
     close(f1);
     close(f2);
end.