#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s;
    cin >> s;
    char ch = s[0];
    int num = 0;
    for(int i = 1; i < s.length(); ++i)
    {
        if(s[i] != ch)
        {
            ++num;
            ch = s[i];
        }
    }
    cout << num << endl;
    return 0;
}