import sys

s = eval(input())

l = 0

r = len(s) - 1

cnt = 0

while l < r:

    if s[l] != s[r]:

        cnt += 1

        if s[l] == 'x':

            l += 1

        elif s[r] == 'x':

            r -= 1

        else:

            print((-1))

            sys.exit(0)

    else:

        l += 1

        r -= 1

print(cnt)
s=eval(input())

l,r=0,len(s)-1

cnt=0

while l<r:

    if s[r]!=s[l]:

        cnt +=1

        if s[l]=="x":l +=1

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

        else:print((-1));exit()

    else:

        r -=1

        l +=1

print(cnt)
import sys

s = eval(input())
l = 0
r = len(s) - 1
cnt = 0
while l < r:
    if s[l] != s[r]:
        cnt += 1
        if s[l] == "x":
            l += 1
        elif s[r] == "x":
            r -= 1
        else:
            print((-1))
            sys.exit(0)
    else:
        l += 1
        r -= 1
print(cnt)

s = eval(input())
l, r = 0, len(s) - 1
cnt = 0
while l < r:
    if s[r] != s[l]:
        cnt += 1
        if s[l] == "x":
            l += 1
        elif s[r] == "x":
            r -= 1
        else:
            print((-1))
            exit()
    else:
        r -= 1
        l += 1
print(cnt)

-import sys - -l = 0 -r = len(s) - 1 +l, r = 0, len(s) - 1 -    if s[l] != s[r]: +    if s[r] != s[l]: -            sys.exit(0) +            exit() +        r -= 1 -        r -= 1