#include<bits/stdc++.h>
using namespace std;

int main(){
  int i,N,K,a=0,b,cnt=0;
  char ss[100001];
  scanf("%s",ss);
  N=strlen(ss);
  b=N-1;
  while(a<b){
    if(ss[a]==ss[b]){
      a++;
      b--;
      continue;
    }else if(ss[a]=='x'){
      a++;
      cnt++;
      continue;
    }else if(ss[b]=='x'){
      b--;
      cnt++;
      continue;
    }else{
      printf("-1");
      return 0;
    }
  }
  printf("%d",cnt);
  return 0;
}