#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char s[100004];
int main() {
	scanf("%s",s+1);
	int l=1,r=strlen(s+1),ans=0;
	while (l<=r) {
		if (l==r) break;
		if (s[l]==s[r]) {++l,--r;continue;}
		if (s[l]=='x') {++l,++ans;continue;}
		if (s[r]=='x') {--r,++ans;continue;}
		puts("-1");
		return 0;
	}
	printf("%d\n",ans);
	return 0;
}