function main(input) {
  var stones = input.split("")
  var counter = 0

  while (stones.some(function(stone, i, a) {
    if (i < a.length - 1 && stone == "B" && a[i + 1] == "W") {
      var tmp = a[i]
      a[i] = a[i + 1]
      a[i + 1] = tmp
      return true
    }
  })) {
    counter ++
  }

  console.log(counter)
}

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