let string_to_list str =
  let rec loop i limit =
    if i = limit then []
    else (String.get str i) :: (loop (i + 1) limit)
  in
  loop 0 (String.length str)

let solve s =
  let lis = string_to_list s in
  let rec diff = function
      [] -> 0
    | x::y::xs when x <> y -> 1 + diff (y::xs)
    | x::y::xs when x == y -> diff (y::xs)
    | _ -> 0
  in diff lis
              

let () =
  let rec read () =
    try let ans = (Scanf.scanf "%s\n" solve) in
        Printf.printf "%d\n" ans
    with End_of_file -> ()
  in
  read ()
;;
