#include<bits/stdc++.h>
using namespace std;
using ll=long long;
string s;
int ans;
int main(){
    cin>>s;
    int l{},r=s.size()-1;
    while(l<r){
        if(s[l]==s[r]){++l,--r;continue;}
        if(s[l]!='x'&&s[r]!='x'){
            cout<<-1<<endl;
            return 0;
        }
        if(s[l]=='x')++l,++ans;
        else --r,++ans;
    }
    cout<<ans<<endl;
}
