var
s:ansistring;
len,i,t,ans:longint;
begin
readln(s);
len:=length(s);
for i:=1 to len do
begin
t:=pos('bear',copy(s,i,len-i+1));//找子序列中'bear'出现的位置
if t>0 then inc(ans,len-i-t-1);//累加
end;
writeln(ans);
end.
相关文章:
var
s:ansistring;
len,i,t,ans:longint;
begin
readln(s);
len:=length(s);
for i:=1 to len do
begin
t:=pos('bear',copy(s,i,len-i+1));//找子序列中'bear'出现的位置
if t>0 then inc(ans,len-i-t-1);//累加
end;
writeln(ans);
end.
相关文章: