program main
	implicit none
    character*100000 s
    integer::ans=0
    integer l,r
    read *,s
    l=1
    r=len_trim(s)
    do while(l<r)
    	if(s(l:l)==s(r:r)) then
        	l=l+1
            r=r-1
        else if(s(l:l)=='x') then
        	ans=ans+1
            l=l+1
        else if(s(r:r)=='x') then
        	ans=ans+1
            r=r-1
        else
        	print '(i0)',-1
            stop
        end if
    end do
    print '(i0)',ans
end program main