Pagini recente » Cod sursa (job #414232) | Cod sursa (job #522891) | Cod sursa (job #716962) | Cod sursa (job #1557389) | Cod sursa (job #13689)
Cod sursa(job #13689)
type as=ansistring;
var fi,fo:text;
a,s:as;
nc,nl,rez:longword;
ok:boolean;
c:char;
{ procedure solve;
var i:longword;
begin
i:=1;
nc:=1;
while pos('-',s)<>0 do
begin
if s[pos('-',s)+1] in[('a')..('z'),('A')..('Z')] then inc(nc);
delete(s,pos('-',s),1);
end;
while i<=length(s) do
if not (s[i] in[('a')..('z'),('A')..('Z')]) and
(s[i]<>' ') then
delete(s,i,1)
else inc(i);
while pos(' ',s) =1 do
delete(s,1,1);
ok:=false;
while pos(' ',s) <>0 do
begin
c:=pos(' ',s);
if s[c+1]<>' ' then inc(nc);
delete(s,c,1);
end;
nl:=length(s);
rez:=trunc(nl/nc);
end;
}
procedure solve;
var i:longword;
begin
nc:=0;
nl:=0;
i:=1;
while not eoln(fi) do
begin
read(fi,c);
if c in [('a')..('z'),('A')..('Z')] then
begin
inc(nc);
while c in [('a')..('z'),('A')..('Z')] do
begin
read(fi,c);
inc(nl);
end;
end;
end;
if nc<>0 then rez:=trunc(nl/nc)
else rez:=0;
end;
begin
assign(fi,'text.in'); reset(fi);
assign(fo,'text.out'); rewrite(fo);
solve;
{ writeln(fo,nl);
writeln(fo,nc); }
writeln(fo,rez);
close(fi);
close(fo);
end.