#include <iostream>
#include <cmath>
//#include <cstdio>
#include <vector>
#include <string>

using namespace std;

int main() {
    string othello;
    bool flag = 0;
    int count = 0;
    int piece;

    cin >> othello;


    //if (othello[0] == 'B' )
    //{
    //    piece = BLACK;
    //}
    //else
    //{
    //    piece = WHITE;
    //}

    for (int i = 1; i < size(othello); i++)
    {
        if (othello[i] != othello[i - 1])
        {
            count++;
        }
    }

    cout << count << endl;


    return 0;
}