#include <bits/stdc++.h>
using namespace std;
bool dp[5010][5010];
int ans;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i > j) dp[i][j] = 0;
      if (j - i < 3)
        dp[i][j] = 0;
      else {
        if ((s[j] == 'r' && s[j - 1] == 'a' && s[j - 2] == 'e' &&
             s[j - 3] == 'b') ||
            dp[i][j - 1]) {
          dp[i][j] = 1;
          ans++;
        } else
          dp[i][j] = 0;
      }
    }
  }
  cout << ans;
  return 0;
}
