#include <bits/stdc++.h>
using namespace std;
void Q_Q() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
int main() {
  Q_Q();
  string s;
  cin >> s;
  vector<int> v;
  long long int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if ((i + 3) < s.length()) {
      if (s[i] == 'b' && s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'r')
        v.push_back(i + 3);
    }
  }
  int c = 0;
  for (int i = 0; i < s.length(); i++) {
    if ((i + 3) < s.length() && c < v.size()) {
      if (s[i] == 'b' && s[i + 1] == 'e' && s[i + 2] == 'a' &&
          s[i + 3] == 'r') {
        ans += ((s.length() - v[c]));
        c++;
      } else {
        ans += ((s.length() - v[c]));
      }
    }
  }
  cout << ans;
  return 0;
}
