import Data.List
--import Control.Monad

main = do
  s <-  getLine
  putStrLn .show $ solve s

solve:: String -> Int
solve s = length s - (nyo "" 2 $ reverse s)

nyo:: String -> Int -> String -> Int
nyo p n (s1:s2:ss)
  | length kk == 0 = n
  | otherwise = nyo kk (n + 2) ss
  where
    kk = cho (s1:s2:ss) p

cho:: String -> String -> String
cho (s1:s2:s) a
  | s1 == s2 = a
  | otherwise = hoge (s1:s2:a)

hoge:: String -> String
hoge s = map head $ filter (\x -> length x == 1) $ group $ sort s
