#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    string s1 = "Bob";
    int index = 0;
    transform(s.begin(),s.end(),s.begin(),::tolower);
    transform(s1.begin(),s1.end(),s1.begin(),::tolower);
    for(int i=0;i < s.size();)
    {
        if(s[i] == s1[index])
        {
            index++;
            i++;
            if(index == 3)
            {
                cout << i-3;
                return 0;
            }
        }
        else
        {
            i -= (index-1);
            index = 0;
        }
    }
    cout << "-1";
}
// 64 位输出请用 printf("%lld")