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

	var exp = /BW/g
	for (;;) {
		var counter = 0
		while (result = exp.exec(src)) {
			counter++
		}
		if (counter === 0) {
			break
		}
		sum_counter += counter
		src = src.replace(exp, "WB")
	}
	console.log(sum_counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));