#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
char a[100003];
int main()
{
	gets(a);
	int l=0,r=strlen(a)-1,pd=1,ans=0;
	while(l<r)
	{
		if(a[l]==a[r])
		{
			l++;
			r--;
		}
		if(a[l]!=a[r])
		{
			if(a[l]=='x'||a[r]=='x')
			{
				if(a[l]=='x')l++;
				if(a[r]=='x')r--;
				ans++;
			}
			else 
			{
				ans=-1;
				break;
			}
		}
	}
	cout<<ans;
	return 0;
}
