#include <bits/stdc++.h>
using namespace std;
const int N = (int)(2e5 + 2);
int psum[N];
int getsum(int from, int to) {
  if (from > to) return 0;
  int sum = psum[to];
  if (from > 0) sum -= psum[from - 1];
  return sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n - 3; ++i) {
    if (s[i] == 'b' && s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'r') {
      ++psum[i];
    }
    if (i) psum[i] += psum[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < n - 3; ++i) {
    for (int j = i + 3; j < n; ++j) {
      if (getsum(i, j - 3) > 0) ++ans;
    }
  }
  cout << ans;
  return 0;
}
