import qualified Data.ByteString.Char8 as BS
import           Debug.Trace

main = do
  s <- BS.getLine

  let s0 = BS.filter (/= 'x') s
      s1 = BS.reverse s0

      checkc i j n | i < 0 && j >= BS.length s    = n
                   | i < 0                        = n + BS.length s - j
                   | j >= BS.length s             = n + i + 1
                   | BS.index s i == BS.index s j = checkc (i-1) (j+1) n
                   | BS.index s i == 'x'          = checkc (i-1) j (n+1)
                   | otherwise                    = checkc i (j+1) (n+1)

      findi i j m | BS.index s j /= 'x' && i == m = j
                  | BS.index s j /= 'x'           = findi i (j+1) (m+1)
                  | otherwise                     = findi i (j+1) m

      len0 = BS.length s0

      findIJ | len0 `mod` 2 == 1 = let i = findi (len0 `div` 2) 0 0 in (i-1, i+1)
             | otherwise         = (findi (len0 `div` 2 - 1) 0 0, findi (len0 `div` 2)     0 0)

      solve | s0 /= s1  = (-1)
            | otherwise = let (i, j) = findIJ
                          in checkc i j 0

  print solve