#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int len ;
char s[100005] ;

int main(){
	scanf("%s",s+1) ;
	len=strlen(s+1) ;
	int last=s[1] , ans=0 ;
	for(int i=2;i<=len;++i){
		if(last!=s[i]) last=s[i] , ans++ ;
	}
	cout << ans << '\n' ;
	return 0;
}