let rec solve acc s l r =
  if r <= l then Some acc
  else if s.[l] = s.[r] then solve acc s (l + 1) (r - 1)
  else if s.[l] = 'x' then solve (1 + acc) s (l + 1) r
  else if s.[r] = 'x' then solve (1 + acc) s l (r - 1)
  else None
let solve s = solve 0 s 0 (String.length s - 1)

let () =
  let s = read_line () in
  solve s
  |> (function None -> -1 | Some x -> x)
  |> Printf.printf "%d\n"
