import Data.List

main = do
    s <- getLine
    let l = length s
    let d = sum . map (ptn . length) . group $ sort s
    let r = ptn l + 1
    print $ r - d
        where
            ptn n = n * (n-1) `quot` 2
