def solve():

    s = eval(input())

    n = len(s)



    left = 0

    right = n - 1



    ret = 0

    while left < right:

        if s[left] == s[right]:

            left += 1

            right -= 1

        elif s[left] == 'x':

            ret += 1

            left += 1

        elif s[right] == 'x':

            ret += 1

            right -= 1

        else:

            return -1

    return ret





print((solve()))

def main():

    s = eval(input())



    l = 0

    r = len(s) - 1



    ret = 0

    while l < r:

        lc, rc = s[l], s[r]



        if lc == rc:

            l += 1

            r -= 1

            continue



        if lc == 'x':

            ret += 1

            l += 1

            continue



        if rc == 'x':

            ret += 1

            r -= 1

            continue



        print((-1))

        return



    print(ret)





if __name__ == '__main__':

    main()

def solve():
    s = eval(input())
    n = len(s)
    left = 0
    right = n - 1
    ret = 0
    while left < right:
        if s[left] == s[right]:
            left += 1
            right -= 1
        elif s[left] == "x":
            ret += 1
            left += 1
        elif s[right] == "x":
            ret += 1
            right -= 1
        else:
            return -1
    return ret


print((solve()))

def main():
    s = eval(input())
    l = 0
    r = len(s) - 1
    ret = 0
    while l < r:
        lc, rc = s[l], s[r]
        if lc == rc:
            l += 1
            r -= 1
            continue
        if lc == "x":
            ret += 1
            l += 1
            continue
        if rc == "x":
            ret += 1
            r -= 1
            continue
        print((-1))
        return
    print(ret)


if __name__ == "__main__":
    main()

-def solve(): +def main(): -    n = len(s) -    left = 0 -    right = n - 1 +    l = 0 +    r = len(s) - 1 -    while left < right: -        if s[left] == s[right]: -            left += 1 -            right -= 1 -        elif s[left] == "x": +    while l < r: +        lc, rc = s[l], s[r] +        if lc == rc: +            l += 1 +            r -= 1 +            continue +        if lc == "x": -            left += 1 -        elif s[right] == "x": +            l += 1 +            continue +        if rc == "x": -            right -= 1 -        else: -            return -1 -    return ret +            r -= 1 +            continue +        print((-1)) +        return +    print(ret) -print((solve())) +if __name__ == "__main__": +    main()