function main(arg) {
	var src = arg.split("\n")[0]
	var register = []
	var sum_counter = 0

	for (;;) {
		var counter = 0
		src = src.split("BW")
		if (src.length === 1) {
			break
		}
		counter += src.length - 1
		src = src.join("WB")
		sum_counter += counter
	}
	console.log(sum_counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));