s = input()
i, j = 0, len(s) - 1
ans = 0
while i < j:
    if s[i] == s[j]:
        i, j = i + 1, j - 1
    elif s[i] == 'x':
        i += 1
        ans += 1
    elif s[j] == 'x':
        j -= 1
        ans += 1
    else:
        ans = -1
        break
print(ans)

427066dac93c3aac9ff8cb7c4aa85f7951601dc2
<mask token>

<mask token>
while i < j:
    if s[i] == s[j]:
        i, j = i + 1, j - 1
    elif s[i] == 'x':
        i += 1
        ans += 1
    elif s[j] == 'x':
        j -= 1
        ans += 1
    else:
        ans = -1
        break
print(ans)

s = input()
i, j = 0, len(s) - 1
ans = 0
while i < j:
    if s[i] == s[j]:
        i, j = i + 1, j - 1
    elif s[i] == 'x':
        i += 1
        ans += 1
    elif s[j] == 'x':
        j -= 1
        ans += 1
    else:
        ans = -1
        break
print(ans)
