"use strict";

function Main(input) {
	input = input.split('');
	let flips = 0;
	for (let i = 0; i < input.length - 1; i++) {
		if (!(input[i] === 'B' && input[i + 1] === 'W')) continue;

		flips++;
		input[i] = 'W';
		input[i + 1] = 'B';
		i = -1;
	}

	console.log(flips);
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));