Pagini recente » Cod sursa (job #2695903) | Cod sursa (job #1129994) | Cod sursa (job #323504) | Istoria paginii runda/oji_2 | Cod sursa (job #728961)
Cod sursa(job #728961)
var f:text;
cl,cw,mid:longint;
c:char;
nc:boolean;
const ALFABET = ['A'..'Z', 'a'..'z'];
begin
cl:=0;
cw:=0;
nc:=false;
assign(f, 'text.in');
reset(f);
while not EOF(f) do begin
read(f, c);
if c in ALFABET then begin
cl:=cl+1;
nc:=true;
end
else if nc=true then begin
cw:=cw+1;
nc:=false;
end;
if(EOF(f)) AND (nc=true) then cw:=cw+1;
end;
close(f);
assign(f, 'text.out');
rewrite(f);
if(cw > 0) then begin
mid:=cl div cw;
write(f, mid);
end;
close(f);
end.