let s = read_line ()
let n = String.length s
let l, r, ans = ref 0, ref @@ n - 1, ref 0
let _ = while !l < !r do if s.[!l] <> s.[!r] then if s.[!l] = 'x' then (incr l; incr ans) else if s.[!r] = 'x' then (decr r; incr ans)
  else (print_endline "-1"; exit 0) else (incr l; decr r) done; Printf.printf "%d\n" !ans