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