'use strict'

const main = (INPUT) => {
  let S = INPUT.split('\n')[0]
  let ans = 0
  for (let i = S.indexOf('BW'); i != -1;) {
    if (S[i] == 'B' && S[i + 1] == 'W') {
      ans += (S.match(/BW/g) || []).length
      S = S.replace(/BW/g, 'WB')
      i = S.indexOf('BW')
      continue
    }
    i = S.indexOf('BW', i + 1)
  }
  console.log(ans)
}

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