object Main extends App {
  private def func(s:Array[Char]):Int = {
    var count = 0
    var find = false
    var lastmin = 0
    do{
      var i=lastmin
      find = false
      while(i < s.size-1 /*&& !find*/){
        if(s(i)=='W' && s(i+1)=='B'){
          s(i  )='B'
          s(i+1)='W'
          if(!find) lastmin = i
          find=true
          count +=1 
        }else{
          i+=1
        }
        //println(count, i, find, s.toSeq)
      } 
    } while(find)
    count
  }
  println(func(io.Source.stdin.getLines.toIndexedSeq.head.toCharArray.reverse))
}
