Pagini recente » Cod sursa (job #1788248) | Cod sursa (job #431747) | Cod sursa (job #1749027) | Cod sursa (job #1638619) | Cod sursa (job #6134)
Cod sursa(job #6134)
var f,g:text;
n,i,s,nr,a,b:integer;
c:char;
function lit(ch:char):boolean;
begin
if (upcase(ch)<='Z')and(upcase(ch)>='A') then lit:=true
else lit:=false;
end;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(G);
n:=0;
a:=-1;b:=-1;s:=0;nr:=0;
while not eoln(f) do
begin
read(f,c);
if lit(c)=true then
begin
if a=-1 then
begin
a:=0;
b:=0;
end
else
b:=b+1 end
else begin
if a<>-1 then
begin
s:=s+b-a+1;
nr:=nr+1;
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.