Pagini recente » Cod sursa (job #1275153) | Cod sursa (job #1628529) | Cod sursa (job #1237134) | Cod sursa (job #703684) | Cod sursa (job #71229)
Cod sursa(job #71229)
program text;
var s:string;
l,c:integer;
gasit:boolean;
procedure afisare;
var i:integer;
begin
assign(output,'text.out');
rewrite(output);
if c<>0 then
i:=trunc(l/c)
else i:=0;
write(i);
close(output);
end;
procedure procesare;
var i:integer;
begin
for i:=1 to length(s) do
if (s[i] in ['A'..'Z','a'..'z']) then
begin
l:=l+1;
gasit:=true;
end
else if (s[i-1] in ['A'..'Z','a'..'z']) and
not (s[i] in ['A'..'Z','a'..'z']) and (l>=1) then
begin
inc(c);
gasit:=false;
end;
if s[length(s)]in ['A'..'Z','a'..'z']
then c:=c+1;
end;
procedure citire;
begin
assign(input,'text.in');
reset(input);
gasit:=false;
while not eof do
begin
if gasit then
c:=c-1;
readln(s);
procesare;
end;
afisare;
close(input);
end;
begin
citire;
end.