'use strict'

const main = (INPUT) => {
  let S = INPUT.split('\n')[0].split('')
  let ans = 0
  for (let i = S.join('').indexOf('BW'); i < S.length - 1;) {
    S[i] = 'W'
    S[i + 1] = 'B'
    ans++
    i = S.join('').indexOf('BW')
    if (i == -1) {
      break
    }
  }
  console.log(ans)
}

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