#include <iostream>
#include <vector>

using namespace std;


int main()
{
    long long int x;
    int i = 0, p, u = 0;
    short int q;
    cin>>x;
    vector<short int> a;
    while(x > 0)
    {
        a.push_back(x%10);
        x /= 10;
        i++;
    }

    for(int j = 0;j < i; j++ )
    {
        p = 0;
        for(int k = i+1; k < i; k++)
        {
            if(a[j] != a[k])
            {
                p++;
            }
            else
            {
                break;
            }
        }
        u += p;
    }
    cout<<u;


}