let () =
  let s = read_line () in
  Array.init (String.length s) (fun i -> s.[i])
  |> Array.mapi (fun i -> function
    | 'U' -> 2 * i + String.length s - 1 - i
    | 'D' -> i + (String.length s - 1 - i) * 2)
  |> Array.fold_left ( + ) 0
  |> Printf.printf "%d\n"