#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    vector<int> br;
    string broj;
    char cifra;
    int prom, a[100000], n, i, j;
    cin >> broj;
    n = broj.length();
    prom = 0;
    cifra = broj[0];
    a[0] = int(cifra) - 48;
    br.push_back(a[0]);
    for(j = 1; j < n; j++)
    {
        cifra = broj[j];
        a[j] = int(cifra) - 48;
        br.push_back(a[j]);
        //cout << a[j];
        i = 0;
        while(j - i - 1 >= 0 && a[j] != br[j-i-1])
        {
              i++;
        }

        if(a[j] == br[j-i-1]  && i+1 > 2)
        {
            br[j] = br[j - 1];
            prom++;
        }
        if(a[j] == br[j-i-1] && i+1 == 2)
        {
            br[j-1] = br[j];
            prom++;
        }
    }
    cout <<  prom;
    //for(j = 0; j < n; j++) cout << br[j];
    return 0;
}