Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i prev acc =
        if i = n then acc else
            if s.[i] = prev then loop (i + 1) prev acc else
                loop (i + 1) s.[i] (acc + 1)
    in
    loop 1 s.[0] 0 |> Printf.printf "%d\n"
)