let rec solve acc i s =
  if String.length s <= i + 1 then acc
  else if s.[i] = 'B' && s.[i + 1] = 'W' then begin
    s.[i] <- 'W';
    s.[i + 1] <- 'B';
    solve (acc + 1) (max 0 (i - 1)) s
  end else solve acc (i + 1) s
let solve = solve 0 0

let () =
  let s = read_line () in
  Printf.printf "%d\n" @@ solve s

