main = do
  s <- getLine
  print (revcomp s)

revcomp s = comb2 l - sum (map comb2 napp) + 1
  where
    l = length s
    napp = map (\c -> length (filter (==c) s)) ['a'..'z']

comb2 n = div (n * (n-1)) 2