We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly:    * Insert a letter `x` to any position in s of his choice, including the beginning and end of s.  Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is achievable, find the minimum number of operations required.
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline



#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import numpy as np

def main():
	s=input().decode()
	t=s[::-1]
	#print(s,t)

	l=len(s)

	ss=0
	tt=0

	ans=0

	while ss<l//2 and tt<l//2:

		if s[ss]==t[tt]:
			ss+=1
			tt+=1

		elif s[ss]=="x":
			ans+=1
			l+=1
			ss+=1

		elif t[tt]=="x":
			ans+=1
			l+=1
			tt+=1

		else:
			print(-1)
			exit(0)

	print(ans)
























if __name__ == "__main__":
	main()

import sys
input = sys.stdin.readline().rstrip




#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np


def main():
	s=input()
	#print(s)

	n=len(s)

	l=0
	r=n-1

	ans=0

	while l<r:

		if s[l]==s[r]:
			l+=1
			r-=1

		elif s[l]=="x":
			ans+=1
			l+=1

		elif s[r]=="x":
			ans+=1
			r-=1

		else:
			print(-1)
			exit()

	print(ans)
	return

if __name__ == "__main__":
	main()
