Pagini recente » Cod sursa (job #2514929) | Cod sursa (job #601531) | Cod sursa (job #2241345) | Profil Adriana_S | Cod sursa (job #38375)
Cod sursa(job #38375)
program text;
type sir=array[1..1000]of char;
var s:sir;
l,c,n: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 n do
if (s[i] in ['A'..'Z','a'..'z']) then
begin
l:=l+1;
gasit:=true;
end
else if (l>=1) and (s[i-1] in ['A'..'Z','a'..'z']) and
not (s[i] in ['A'..'Z','a'..'z']) then
begin
inc(c);
gasit:=false;
end;
if s[n]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;
n:=0;
while not eoln do
begin
inc(n);
read(s[n]);
end;
procesare;
end;
afisare;
close(input);
end;
begin
citire;
end.