Cod sursa(job #170784)

Utilizator mariusake212Isac Marius-Sergiu mariusake212 Data 3 aprilie 2008 10:53:57
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.85 kb
var
        s:char;
        f:text;
        n,k,c:longint;
begin
        assign(f,'text.in');
        reset(f);
        n:=0;
        k:=0;
        c:=0;
                while not eof(f) do
                begin
                read(f,s);
            if not (s in['a'..'z']) and not (s in ['A'..'Z'])  then
                        begin
                        if c<>0 then
                                begin
                                n:=n+c;
                                k:=k+1;
                                end;
                        c:=0;
                        end
                                             else c:=c+1;
                        end;
        close(f);
        assign(f,'text.out');
        rewrite(f);
        if k<>0 then write(f, trunc(n/k))
                else write(f,0);
        close(f);
end.