object Main extends App {
  val s = io.StdIn.readLine()
  val check = s.filterNot(_=='x')

  if(check!=check.reverse){
    println(-1)
    sys.exit()
  }

  var ans = 0
  var first = 0
  var latter = 0
  var i = 0
  while( i < (s.length + first + latter)/2){
    if( s(i - first) != s(-1+(-1)*i+latter+s.length) ){
      ans += 1
      if( s(i-first)=='x' ){
        latter += 1
      }else{
        first += 1
      }
    }
    i += 1
  }

  println(ans)

}
