#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
int main(){
	char s[105000];
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	char cur = s[1];int ans = 0;
	for(int i = 2; i <= n; i++)
		if(cur != s[i]) cur = s[i], ans++;
	cout<<ans;
	return 0;
}