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

string ss;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>ss;
	int n = ss.size(), ans = 0;
	bool flag = 1;
	int l = 0, r = n-1;
	while(l < r){
		if(ss[l] != ss[r]){
			if(ss[l]=='x'){
				r++;
				ans++;
			}else if(ss[r]=='x'){
				l--;
				ans++;
			}else{
				flag = 0;
			}
		}
		l++, r--;
	}
	if(!flag) ans = -1;
	cout<<ans<<'\n';
	return 0;
}