#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>

#define M 1000000007

using namespace std;

int main(){
  string s;
  cin >> s;

  int l = 0;
  int r = s.size()-1;
  int n = 0;
  while(l < r){
    if(s[l] != s[r]){
      if(s[l] == 'x'){
	l++;
	n++;
      }else if(s[r] == 'x'){
	r--;
	n++;
      }else{
	n = -1;
	break;
      }
    }else{
      l++;
      r--;
    }
  }

  cout << n << endl;
  
  return 0;
}
