#include <iostream>
#include <string>
using namespace std;

string qufen(string s)
{
    for(int i = 0;i<s.size();i++)
    {
        if(s[i]>=97)
        {
            s[i]-=32;
        }
    }
    return s;
}

void get_next(string T, int* next) {
    int j = -1;
    int i = 0;
    next[0] = -1;
    while (i < T.size() - 1) {
        if (j == -1 || T[i] == T[j]) {
            ++i;
            ++j;
            next[i] = j;
        } else {
            j = next[j];
        }

    }
}

int KMP(string S, string T) {
    int ans = -1;
    int i = 0;
    int j = 0;
    int next[255];
    get_next(T, next);
    while (i < S.size()) {
        if (j == -1 || S[i] == T[j]) {
            ++i;
            ++j;
        } else {
            j = next[j];
        }
        if (j == T.size()) {
            ans = i - T.size();
            break;
        }
    }
    return ans;
}

int main() {
    string S;
    while (cin >> S) { // 注意 while 处理多个 case
        S=qufen(S);
        string T = "Bob";
        T=qufen(T);
        // cout<<S;
        int kmp_index = KMP(S,T);
        cout<<kmp_index;

    }
}
// 64 位输出请用 printf("%lld")

使用kmp算法,快速且简单