#include <bits/stdc++.h>
using namespace std;
int main() {
string line;
getline(cin, line);
size_t ans, dot = line.find_first_of('.');
if (dot != string::npos)
ans = count(line.begin(), line.begin() + dot, 'b');
else
ans = count(line.begin(), line.end(), 'b');
cout << ans << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXN0cmluZyBsaW5lOwoJZ2V0bGluZShjaW4sIGxpbmUpOwoJc2l6ZV90IGFucywgZG90ID0gbGluZS5maW5kX2ZpcnN0X29mKCcuJyk7CglpZiAoZG90ICE9IHN0cmluZzo6bnBvcykKCQlhbnMgPSBjb3VudChsaW5lLmJlZ2luKCksIGxpbmUuYmVnaW4oKSArIGRvdCwgJ2InKTsKCWVsc2UKCQlhbnMgPSBjb3VudChsaW5lLmJlZ2luKCksIGxpbmUuZW5kKCksICdiJyk7Cgljb3V0IDw8IGFucyA8PCBlbmRsOwoJcmV0dXJuIDA7Cn0=