import Data.List

main = do
 a <- getLine
 print $ analyze a

analyze :: String -> Integer
analyze str = 1 + c2 l - foo
 where 
  l = genericLength str
  foo = sum . map c2 . map genericLength . group . sort $ str

c2 :: Integer -> Integer
c2 n = n * (n-1) `div` 2