#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int co = 0;
  for (int i = 0; i < s.size(); i++) {
    bool c = 0;
    for (int j = i + 3; j < s.size(); j++) {
      if (c || (s[j - 3] == 'b' && s[j - 2] == 'e' && s[j - 1] == 'a' &&
                s[j] == 'r'))
        c = 1, co++;
    }
  }
  cout << co;
}
