#include<bits/stdc++.h>
using namespace std;
#define FILE "chad"
#define ll long long
#define up(i,j,k) for(int i=(j);i<=(k);i++)
#define pii pair<int,int>
template<class T> bool cmin(T& a,T b){return a>b?a=b,true:false;}
template<class T> bool cmax(T& a,T b){return a<b?a=b,true:false;}
template<class T> T max(T& a,T& b){return a>b?a:b;}
template<class T> T min(T& a,T& b){return a<b?a:b;}
const int maxn=255000,inf=1e9,mod=9901;
int read(){
	int ch=getchar(),x=0,f=1;
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f*x;
}
char s[maxn];
int n,ans=0;
int main(){
	//freopen(FILE".in","r",stdin);
	//freopen(FILE".out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(s[i]!=s[i-1])ans++;
	}
	cout<<ans-1<<endl;
	return 0;
}

