import numpy as np



S = np.array(list(eval(input())))

num_x = np.count_nonzero(S == 'x')

# print(f'{num_x=}')

A = [s for s in S if s != 'x']

# print(f'{S=}, {A=}')



if len(A) % 2 == 0:

    L = A[:len(A) // 2]

    R = A[len(A) // 2:][::-1]

else:

    L = A[:len(A) // 2]

    R = A[len(A) // 2 + 1:][::-1]

# print(f'{L=}, {R=}')

if not np.all(L == R):

    print((-1))

    exit()



# x以外の文字でsplitをする？'x' '' 'x' ''



T = []

subset = ''

for s in S:

    # print(f'{subset=}')

    if s == 'x':

        subset += 'x'

    else:

        T.append(subset)

        subset = ''

T.append(subset)

len_T = np.array([len(t) for t in T])

# print(f'{T=}, {len_T=}, {len_T - len_T[::-1]}')

ans = np.abs(len_T - len_T[::-1]).sum() // 2

print(ans)

from collections import deque



S = deque(list(eval(input())))



ans = 0

while len(S) > 1:

    l = S.popleft()

    r = S.pop()

    if l == r:

        continue

    elif l == 'x':

        ans += 1

        S.append(r)

    elif r == 'x':

        ans += 1

        S.appendleft(l)

    else:

        print((-1))

        exit()

print(ans)

import numpy as np

S = np.array(list(eval(input())))
num_x = np.count_nonzero(S == "x")
# print(f'{num_x=}')
A = [s for s in S if s != "x"]
# print(f'{S=}, {A=}')
if len(A) % 2 == 0:
    L = A[: len(A) // 2]
    R = A[len(A) // 2 :][::-1]
else:
    L = A[: len(A) // 2]
    R = A[len(A) // 2 + 1 :][::-1]
# print(f'{L=}, {R=}')
if not np.all(L == R):
    print((-1))
    exit()
# x以外の文字でsplitをする？'x' '' 'x' ''
T = []
subset = ""
for s in S:
    # print(f'{subset=}')
    if s == "x":
        subset += "x"
    else:
        T.append(subset)
        subset = ""
T.append(subset)
len_T = np.array([len(t) for t in T])
# print(f'{T=}, {len_T=}, {len_T - len_T[::-1]}')
ans = np.abs(len_T - len_T[::-1]).sum() // 2
print(ans)

from collections import deque

S = deque(list(eval(input())))
ans = 0
while len(S) > 1:
    l = S.popleft()
    r = S.pop()
    if l == r:
        continue
    elif l == "x":
        ans += 1
        S.append(r)
    elif r == "x":
        ans += 1
        S.appendleft(l)
    else:
        print((-1))
        exit()
print(ans)

-import numpy as np +from collections import deque -S = np.array(list(eval(input()))) -num_x = np.count_nonzero(S == "x") -# print(f'{num_x=}') -A = [s for s in S if s != "x"] -# print(f'{S=}, {A=}') -if len(A) % 2 == 0: -    L = A[: len(A) // 2] -    R = A[len(A) // 2 :][::-1] -else: -    L = A[: len(A) // 2] -    R = A[len(A) // 2 + 1 :][::-1] -# print(f'{L=}, {R=}') -if not np.all(L == R): -    print((-1)) -    exit() -# x以外の文字でsplitをする？'x' '' 'x' '' -T = [] -subset = "" -for s in S: -    # print(f'{subset=}') -    if s == "x": -        subset += "x" +S = deque(list(eval(input()))) +ans = 0 +while len(S) > 1: +    l = S.popleft() +    r = S.pop() +    if l == r: +        continue +    elif l == "x": +        ans += 1 +        S.append(r) +    elif r == "x": +        ans += 1 +        S.appendleft(l) -        T.append(subset) -        subset = "" -T.append(subset) -len_T = np.array([len(t) for t in T]) -# print(f'{T=}, {len_T=}, {len_T - len_T[::-1]}') -ans = np.abs(len_T - len_T[::-1]).sum() // 2 +        print((-1)) +        exit()