main::IO()
main =do
  d<-getLine
  print (solver (trans d))

trans::String -> [Bool]
trans cs = map (\x-> if x=='B' then True else False) cs

solver :: [Bool]->Int
solver     []   =0
solver (_:[])   =0
solver (x:y:dat)=if x==y then solver (y:dat) else 1+(solver (y:dat))