#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
string s;
int a[10000005]={0};
int main()
{	
	cin>>s;
	n=s.length();
	for(int i=0;i<n;i++)if(s[i]=='W')a[i]=1;
	int ans=0;
	for(int i=0;i+1<n;i++)if(a[i]!=a[i+1])ans++;
	cout<<ans;
	return 0;
}