Pagini recente » Cod sursa (job #628105) | Cod sursa (job #1146450) | Cod sursa (job #1153105) | Cod sursa (job #2349033) | Cod sursa (job #13678)
Cod sursa(job #13678)
type as=ansistring;
var fi,fo:text;
a,s:as;
nc,nl,rez,c:longword;
ok:boolean;
{ 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;
i:=1;
while i<=length(s) do
begin
if s[i] in [('a')..('z'),('A')..('Z')] then
begin
inc(nc);
while s[i] in [('a')..('z'),('A')..('Z')] do
begin
inc(nl);
inc(i);
end;
end;
inc(i);
end;
rez:=trunc(nl/nc);
end;
begin
assign(fi,'text.in'); reset(fi);
assign(fo,'text.out'); rewrite(fo);
read(fi,a);
s:=a;
solve;
{writeln(fo,nl);
writeln(fo,nc); }
writeln(fo,rez);
close(fi);
close(fo);
end.