import Control.Monad
import Data.List
-- import qualified Data.Map.Strict as M

main=do
    s <- getLine
--    print.(+) 1.(-) (comb2 $ length s).sum.map (comb2.snd).M.toList $ foldl (\m k->M.insertWith(+)k 1 m) M.empty s
    print.(+) 1.(-) (comb2 $ length s).sum $ map (\c->comb2.length$filter(==c)s) ['a'..'z']

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