#include<iostream>
using namespace std;

int main(){
	string n,r;
	int z;
	z = 0;
	cin >> n;
	int c[n.length()];
	for (int i = 1; i < n.length()-1; i++){
		if (n.length() < 4){
			z = 0;
		}
		else {
			if (n[i] == n[i+1] and n[i] != n[i-1]){
			    z = z+1;
		    }
		    if ((n[0] == n[n.length()-1] and n[1] != n[2]) and i == n.length()-2){
		    	z = z+1;
			}
		}
	}
	cout << z;
}