"use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }

function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }

var main = function main(input) {
  var stones = _toConsumableArray(input);

  var counter = 0;

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

  console.log(counter);
};

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