Pagini recente » Cod sursa (job #473532) | Cod sursa (job #451128) | Cod sursa (job #2209792) | Cod sursa (job #591583) | Cod sursa (job #215842)
Cod sursa(job #215842)
var
s,s1: string;
lcuv,stot,ct,nrcuv,ok,i,j,ok1: integer;
f,g: text;
pr,fin: boolean;
begin
assign(f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
readln(f,s);
close(f);
ct:=1; nrcuv:=0; stot:=0; ok:=0; s1:=s; lcuv:=0;
while ct<>length(s) do
begin
if ((s1[ct]<='z') and (s1[ct]>='a')) or ((s1[ct]<='Z') and (s1[ct]>='A'))
then begin
inc(lcuv);
inc(stot);
end
else if ((s1[ct+1]<='z') and (s1[ct+1]>='a')) or ((s1[ct+1]<='Z') and (s1[ct+1]>='A'))
then inc(nrcuv);
lcuv:=0;
inc(ct);
end;
if ((s1[length(s)]<='z') and (s1[length(s)]>='a')) or ((s1[length(s)]<='Z') and (s1[length(s)]>='A')) then pr:=true
else pr:=false;
fin:=false; ok1:=0;
if ((s1[1]<='z') and (s1[1]>='a')) or ((s1[1]<='Z') and (s1[1]>='A')) then inc(nrcuv);
for i:=1 to length(s) do
if ((s[i]<='z') and (s[i]>='a')) or ((s[i]<='Z') and (s[i]>='A')) then inc(ok)
else break;
if (ok=length(s)) and (pr=true)
then begin write(g,stot); fin:=true; end
else begin for j:=1 to length(s) do
if ((s[j]<='z') and (s[j]>='a')) or ((s[j]<='Z') and (s[j]>='A')) then break
else inc(ok1);
if (ok1=length(s)) and (pr=false) then begin write(g,'0'); fin:=true; end;
end;
if fin=false then
write(g,trunc(stot/nrcuv));
close(g);
end.