#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
string s;
int main()
{
	cin>>s;
	int l=s.size();
	s=" "+s;
	int cnt1=1,cnt2=l;
	int ans=0;
	while(cnt1<=cnt2)
	{
		if(cnt1==cnt2)break;
		if(s[cnt1]==s[cnt2]){cnt1++,cnt2--;continue;}
		if(s[cnt1]=='x'){cnt1++;ans++;continue;}
		if(s[cnt2]=='x'){cnt2--;ans++;continue;}
		ans=-1;break;
	}
	cout<<ans<<endl;
}