import qualified Data.ByteString.Char8 as BS
import Control.Monad.ST
import Control.Applicative
import Control.Monad
import Data.Array.ST
import Data.Array
import Data.List
import Debug.Trace

main = do
  s <- getLine

  let
    len = length s
    a = len * (len-1) `div` 2
    b = (sum . map ((\x -> x*(x-1)`div`2) . length) . group . sort) s 

  print $ a - b + 1
