from collections import deque



S = eval(input())



ans = 0

Q = deque(S)

while len(Q) >= 2:

    left = Q.popleft()

    right = Q.pop()

    if left != right:

        if left == 'x':

            Q.append(right)

            ans += 1

        elif right == 'x':

            Q.appendleft(left)

            ans += 1

        else:

            print((-1))

            quit()

print(ans)
from collections import deque



S = eval(input())



ans = 0

Q = deque(S)

while len(Q) >= 2:

    left, right = Q[0], Q[-1]



    if left == right:

        Q.popleft()

        Q.pop()

    elif left == 'x':

        Q.popleft()

        ans += 1

    elif right == 'x':

        Q.pop()

        ans += 1

    else:

        print((-1))

        quit()



print(ans)
from collections import deque

S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
    left = Q.popleft()
    right = Q.pop()
    if left != right:
        if left == "x":
            Q.append(right)
            ans += 1
        elif right == "x":
            Q.appendleft(left)
            ans += 1
        else:
            print((-1))
            quit()
print(ans)

from collections import deque

S = eval(input())
ans = 0
Q = deque(S)
while len(Q) >= 2:
    left, right = Q[0], Q[-1]
    if left == right:
        Q.popleft()
        Q.pop()
    elif left == "x":
        Q.popleft()
        ans += 1
    elif right == "x":
        Q.pop()
        ans += 1
    else:
        print((-1))
        quit()
print(ans)

-    left = Q.popleft() -    right = Q.pop() -    if left != right: -        if left == "x": -            Q.append(right) -            ans += 1 -        elif right == "x": -            Q.appendleft(left) -            ans += 1 -        else: -            print((-1)) -            quit() +    left, right = Q[0], Q[-1] +    if left == right: +        Q.popleft() +        Q.pop() +    elif left == "x": +        Q.popleft() +        ans += 1 +    elif right == "x": +        Q.pop() +        ans += 1 +    else: +        print((-1)) +        quit()