
{-# LANGUAGE BangPatterns #-}

import Data.Array (Array, listArray, accumArray, (!))
import Data.List (sortOn, sortBy)

solv xs = go xs [] 0 where
  go [] _ !n = n
  go !(x:xs) [] !n = go xs [x] n
  go !(x:xs) !(s:ss) !n
    | x==s = go xs (x:s:ss) n
    | x/=s = go xs ss (n+2)

main = do
  s <- getLine
  print $! solv s
