#include<iostream>
#include<list>
#include<algorithm>
#include<string>
using namespace std;
long long a[1000000],broj=0;
string s;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    getline(cin,s);
    for(int i=0;i<s.length();i++){
			     a[i]=s.at(i)-48;
    }
	for(int i=0;i<s.length();i++){
		if(a[i]==a[i+2] && a[i]!=a[i+1]){
			a[i+1]=a[i];
			broj++;
		}
	}
	cout<<broj;
    return 0;
}