#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a, b, c = 0, d = 0, f = 0, cnt = 0;
  a = s.size();
  for (int i = 0; i < a; i++) {
    for (int j = i; j < a; j++) {
      if (f == 1) {
        continue;
      }
      if (s[j] == 'b' && s[j + 1] == 'e' && s[j + 2] == 'a' &&
          s[j + 3] == 'r') {
        b = j + 4;
        d = 1;
        f = 1;
        continue;
      }
    }
    if (d == 1) {
      c = a - b + 1;
    }
    d = 0;
    cnt += c;
    c = 0;
    f = 0;
  }
  cout << cnt;
}
