main = do
    s <- getLine
    let y = ans s
    print y
    
uni :: String -> String
uni (a:b:xs)
    | a /= b = xs
    | otherwise = (a:(uni (b:xs)))
uni [a] = [a]
uni [] = []

ans :: String -> Int
ans s
    | uni s /= s = (ans $ uni s) + 2
    | otherwise = 0
    