module CharMap = Map.Make (struct
  type t = char
  let compare = compare
end)

let () =
  let a = read_line () in
  Array.init (String.length a) (fun i -> a.[i])
  |> Array.fold_left (fun m c ->
      CharMap.add c (1 + try CharMap.find c m with Not_found -> 0) m) CharMap.empty
  |> (fun m -> CharMap.fold (fun _ n acc -> acc + n * (n + 1) / 2) m 0)
  |> (fun n -> 1 + String.length a * (String.length a + 1) / 2 - n)
  |> Printf.printf "%d\n"