from fractions import gcd

from datetime import date

from math import factorial

import functools

from heapq import*

from collections import deque

import collections

import math

from collections import defaultdict, Counter

import sys

sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

inf = float("inf")





def main():

    s = list(eval(input()))

    n = len(s)

    l, r = 0, n-1



    ans = 0

    while l < n and r >= 0 and l < r:

        if s[l] == "x" or s[r] == "x":

            if s[l] == "x" and s[r] == "x":

                l += 1

                r -= 1

            elif s[l] == "x":

                l += 1

                ans += 1

            elif s[r] == "x":

                r -= 1

                ans += 1

        elif s[l] == s[r]:

            l += 1

            r -= 1

        else:

            print((-1))

            exit()

    print(ans)





if __name__ == '__main__':

    main()

def main():

    s = list(eval(input()))

    n = len(s)



    ans = 0

    l, r = 0, n-1

    while l < r:

        if s[l] == "x" or s[r] == "x":

            if s[l] == "x" and s[r] == "x":

                l += 1

                r -= 1

            elif s[l] == "x":

                l += 1

                ans += 1

            elif s[r] == "x":

                r -= 1

                ans += 1

        elif s[l] == s[r]:

            l += 1

            r -= 1

        else:

            print((-1))

            exit()

    print(ans)





if __name__ == '__main__':

    main()

from fractions import gcd
from datetime import date
from math import factorial
import functools
from heapq import *
from collections import deque
import collections
import math
from collections import defaultdict, Counter
import sys

sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
inf = float("inf")


def main():
    s = list(eval(input()))
    n = len(s)
    l, r = 0, n - 1
    ans = 0
    while l < n and r >= 0 and l < r:
        if s[l] == "x" or s[r] == "x":
            if s[l] == "x" and s[r] == "x":
                l += 1
                r -= 1
            elif s[l] == "x":
                l += 1
                ans += 1
            elif s[r] == "x":
                r -= 1
                ans += 1
        elif s[l] == s[r]:
            l += 1
            r -= 1
        else:
            print((-1))
            exit()
    print(ans)


if __name__ == "__main__":
    main()

def main():
    s = list(eval(input()))
    n = len(s)
    ans = 0
    l, r = 0, n - 1
    while l < r:
        if s[l] == "x" or s[r] == "x":
            if s[l] == "x" and s[r] == "x":
                l += 1
                r -= 1
            elif s[l] == "x":
                l += 1
                ans += 1
            elif s[r] == "x":
                r -= 1
                ans += 1
        elif s[l] == s[r]:
            l += 1
            r -= 1
        else:
            print((-1))
            exit()
    print(ans)


if __name__ == "__main__":
    main()

-from fractions import gcd -from datetime import date -from math import factorial -import functools -from heapq import * -from collections import deque -import collections -import math -from collections import defaultdict, Counter -import sys - -sys.setrecursionlimit(10**7) -MOD = 10**9 + 7 -inf = float("inf") - - +    ans = 0 -    ans = 0 -    while l < n and r >= 0 and l < r: +    while l < r: