module String = struct
  include String
  let to_list s =
    let rec loop acc = function
      | 0 -> acc
      | n -> loop (s.[n - 1] :: acc) (n - 1) in
    loop [] (String.length s)
end

let rec tabulate n f = 
  let rec loop acc m =
    if m < n then loop (f m :: acc) (m + 1)
    else List.rev acc in
  loop [] 0

let () =
  read_line ()
    |> String.to_list
    |> List.fold_left (fun (prev, n) c ->
        (c, if prev = c then n else n + 1)) ('X', 0)
    |> (fun (_, n) -> n - 1)
    |> Printf.printf "%d\n"
