#include <bits/stdc++.h>
using namespace std;
char str[5555];
string b = "raeb";
int main() {
  scanf("%s", str);
  int n = strlen(str);
  int ans = 0;
  for (int i = 0; i + 3 < n; ++i) {
    bool ok = 0;
    for (int j = i + 4; j <= n; ++j) {
      bool valid = 1;
      for (int k = 0; k < 4; ++k) {
        valid &= b[k] == str[j - k - 1];
      }
      ok |= valid;
      ans += ok;
    }
  }
  printf("%d\n", ans);
  return 0;
}
