main = do
    s <- getLine
    print . (`div` 2) $ solve 0 s (reverse s)

solve k [] [] = k
solve k (a:as) (b:bs) | a == b = solve k as bs
                      | a == 'x' = solve (k+1) as (b:bs)
                      | b == 'x' = solve (k+1) (a:as) bs
                      | otherwise = -2
solve k [] (b:bs) | b == 'x' = solve (k+1) [] bs
                  | otherwise = -2
solve k (a:as) [] | a == 'x' = solve (k+1) as []
                  | otherwise = -2