local s=io.read()
local l,r=1,#s
local counter=0
while l<r do
    sl=s:sub(l,l)
    sr=s:sub(r,r)
    if sl==sr then
        l=l+1
        r=r-1
    elseif sl=="x" then
        l=l+1
        counter=counter+1
    elseif sr=="x" then
        r=r-1
        counter=counter+1
    else
        print(-1)
        return
    end
end
print(counter)