'use strict'

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

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