Pagini recente » Cod sursa (job #2670848) | Statistici Go Stipha (stipha_gon) | Cod sursa (job #821429) | Cod sursa (job #2755431) | Cod sursa (job #30480)
Cod sursa(job #30480)
const m=['a'..'z','A'..'Z'];
var f,g:text;
s:string;
max,p,i,nr,su:integer;
ok:boolean;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
read(f,s);
i:=1;nr:=0;
s:=s+' ';
max:=0;su:=0;
while s<>'' do begin
i:=1;ok:=false; su:=su+p;p:=0;
while (s[i] in m) and (i<length(s)) do begin ok:=true;inc(i);inc(p);end;
if ok then nr:=nr+1;
if max<p then max:=p;
delete(s,1,p);
if not (s[i] in m) then delete(s,1,1);
end;
write(g,su div nr); close(g);
write(su, ' ',nr);
end.