Pagini recente » Cod sursa (job #5329) | Cod sursa (job #1556495) | Cod sursa (job #2313233) | Cod sursa (job #1389075) | Cod sursa (job #727730)
Cod sursa(job #727730)
var f:text;
c:char;
flag:boolean;
cuv,lit,m:longint;
begin
assign(f,'text.in');
reset(f);
cuv:=0;
flag:=true;
lit:=0;
read(f,c);
if(eof(f)) then m:=-1;
while not eof(f) do
begin
if (not flag)and(c in ['a'..'z','A'..'Z']) then begin
flag:=true;
cuv:=cuv+1;
end;
if c in ['a'..'z','A'..'Z'] then begin
inc(lit);
flag:=true;
end
else
flag:=false;
read(f,c);
if(eof(f)and(flag=true)) then inc(cuv);
end;
close(f);
assign(f,'text.out');
rewrite(f);
if(cuv<>0) then begin
m:=lit div cuv;
write(f,m);
end
else
write(f,0);
close(f);
end.