Pagini recente » Cod sursa (job #136458) | Cod sursa (job #1310920) | Cod sursa (job #2262363) | Cod sursa (job #270697) | Cod sursa (job #393596)
Cod sursa(job #393596)
var f,g:text;
c:char;
k,l:longint;
ok,p:boolean;
begin
assign(f,'text.in');
reset(f);
k:=0;
l:=0;
ok:=true;
while not eof(f) do begin
read(f,c);
if (c=' ')and(k=0) then k:=0
else
if k=0 then k:=1;
if ((c=' ')and(ok=true))or(p=false) then begin
inc(k);
ok:=false;
p:=true;
end
else
if ((ord(c)>=65)and(ord(c)<=90))or((ord(c)>=97)and(ord(c)<=122)) then
begin
inc(l);
ok:=true;
p:=true;
end
else
p:=false;
end;
if (ok=false)and(c=' ') then dec(k);
close(f);
assign(g,'text.out');
rewrite(g);
writeln(g,l div k);
close(g);
end.