Pagini recente » Cod sursa (job #2948241) | Cod sursa (job #1160315) | Cod sursa (job #889815) | Cod sursa (job #2806518) | Cod sursa (job #962490)
Cod sursa(job #962490)
uses crt;
var s:string;
nr,c,i:longint;
f,g:text;
function l(x:char):boolean;
begin
if ((x>='a')and(x<='z'))or((x>='A')and(x<='Z')) then l:=true
else l:=false;
end;
procedure lit(i,j:longint;var x:longint);
begin
if i=j then
begin
if l(s[i]) then inc(x);
end
else
begin
lit(i,j-1,x);
if l(s[j]) then inc(x);
end;
end;
procedure txt(i,j:longint;var nr:longint);
var g:text;
c,h,c1:longint;
begin
nr:=0;c:=0;
if i=j then if l(s[i]) then
begin
inc(nr);
inc(c);
end
else
begin
lit(i,j,nr);
h:=1;
repeat
if l(s[h])=false then inc(h);
until l(s[h])or(h>length(s));
if l(s[h]) then
begin
inc(c);
repeat
inc(h);
until l(s[h])=false;
end;
txt(h+1,j,c1);
c:=c+c1;
assign(g,'text.out');
rewrite(g);
write(g,nr div c);
close(g);
end;
end;
begin
clrscr;
assign(f,'text.in');
reset(f);
readln(f,s);
close(f);
txt(1,length(s),nr);
end.