#include <stdio.h>

int main(void){
	char s[100001],*p=s;
	char c;
	int n=0;
	
	scanf("%s", s);
	c = *p;
	while (*(++p)){
		if (c != *p){
			c = *p;
			n++;
		}
	}
	
	printf("%d\n", n);
	return 0;
}
	