module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  s <- getLine
  print $ min (f s $ cycle ['1', '0']) (f s $ cycle ['0', '1'])
  where
    f s l = length . filter (== False) $ zipWith (==) s l
