main = do
  s <- getLine
  print $ solve s

solve [] = 0
solve [a] = 0
solve [a,b]
  | a == b = 0
  | otherwise = 2
solve (a:b:c:ds)
  | a /= b = 2 + solve (c:ds)
  | b /= c = 2 + solve (a:ds)
  | otherwise = solve (b:c:ds)