Cod sursa(job #179202)

Utilizator AndreiDDiaconeasa Andrei AndreiD Data 15 aprilie 2008 18:56:06
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.71 kb
const m:set of char=['a'..'z','A'..'Z'];
var a,b,s,nr:longint;
f,g:text;
c:char;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
a:=-1;
b:=-1;
s:=0;
nr:=0;
while not eof(f) do begin
read(f,c);
if c in m then
if a=-1 then begin
                            a:=0;
                            b:=0;
                            end
                       else b:=b+1
                                     else begin
                                     if a<>-1 then begin
                       s:=s+b-a+1;
                       inc(nr);
                       end;
a:=-1;
b:=-1;
end;
end;
if a<>-1 then begin
s:=s+b-a+1;
inc(nr);
end;
write(g,s div nr);
close(f);
close(g);
end.