#include <bits/stdc++.h>
using namespace std;
long long mx = -1e9, mn = 1e9;
long long T, n, m, k, a[5005], b[5005], c, x, y, z, ans = 0, h, h1, a1, l, r;
vector<long long> hos[1005];
map<char, long long> mp, mb, mc;
map<char, long long>::iterator it;
queue<long long> q;
pair<long long, pair<long long, long long>> p[4005];
vector<long long> v;
char ch[105][105], cc[105][105];
bool prime[2000005];
int main() {
  string s;
  cin >> s;
  for (int i = 3; i < s.size(); i++) {
    if (s[i] == 'r' && s[i - 1] == 'a' && s[i - 2] == 'e' && s[i - 3] == 'b') {
      v.push_back(i);
    }
  }
  for (int i = 0; i < s.size(); i++) {
    x = -1;
    for (int j = 0; j < v.size(); j++) {
      if (v[j] - 3 >= i) {
        x = v[j];
        break;
      }
    }
    if (x == -1) break;
    ans += s.size() - 1 - x + 1;
  }
  cout << ans;
}
