function main(arg) {
	var src = arg.split("\n")[0].split("")
	var register = []
	var sum_counter = 0
	for (var n = 0; n < 100;n++) {
		var counter = 0
		for (var i = 0; i < src.length; i++) {
			if (src[i] === "B" && src[i+1] === "W") {
				src[i] = "W"
				src[i + 1] = "B"
				var key = String(i) + ":" + String(i + 1)
				// if (register.includes(key)) {
				// 	continue
				// }
				register.push(key)
				counter++
				i++
				// console.log(key)
			}
		}
		// console.log(src)
		// console.log("")
		sum_counter += counter
		if (counter === 0) {
			break
		}
	}
	console.log(sum_counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));