let () =
  Scanf.scanf "%s" @@ fun s ->
  let s = Array.init (String.length s) (fun i -> s.[i]) in
  Array.fold_left (fun (stk, a) c ->
    match stk, c with
    | '0'::stk, '1' | '1'::stk, '0' -> stk, a+2
    | _ -> c::stk, a) ([], 0) s
  |> snd |> Printf.printf "%d\n"