#include <string>
#include <iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	int n = s.size();
	int p = (n + 1) / 2;
	int i = 0,j = 0;
	int x = 0;
	while((i + j) < n){
		if(s[i] != s[n - j - 1]){
			if(s[i] == 'x'){
				j--;
				x++;
			}else if(s[n - j - 1] == 'x'){
				i--;
				x++;
			}else{
				cout << "-1" << endl;
				return 0;
			}
		}
		i++;
		j++;
	}
	cout << x << endl;
	return 0;
}