type stack_back = NULL | S of int * stack

let s = Scanf.scanf "%s\n" (fun x -> x)

let rec area s i sb count =
 match s.[i] with
 '\' -> area s (i+1) (S (i, sb)) count
 |'/' -> 
  match sb with
  NULL -> area s (i+1) NULL count
  S (j, sb') -> area s (i+1) sb' (count+(i-j))
 |_ -> area s (i+1) sb count

let () =
 area s 0 NULL 0 |> Printf.printf "%d\n"