#include <iostream>

using namespace std;
int brcif(unsigned long long n)
{
    int br = 0;
    while (n > 0)
    {
        n/=10;
        br++;
    }
    return br;
}

int main()
{
    unsigned long long n;
    cin >> n;
    int br = brcif (n);
    char a [br];
    int t = 0;
    for (int i = br-1; i >=0; i--)
    {
        a[i] = n % 10 + '0';
        n /= 10;
    }
    for (int i = 1; i < br - 1; i++)
    {
        if (a[i]!= a[i-1] && a[i] != a[i+1])
            t++;
    }
    cout << t;
}