#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int i, ans = 0, temp = 0;
  int l = s.size();
  for (i = 0; i < l; i++) {
    if (s[i] == 'b' && s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'r') {
      ans += (i - temp + 1) * (l - (i + 3));
      temp = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
