#include<bits/stdc++.h>
 
using namespace std;
 
string s;

long long solve(int l, int r){
    if(l>=r) return 0;
    if(s[l]==s[r]){
        return solve(l+1, r-1);
    }
    if(s[l]=='x'){
        return (1+solve(l+1, r));
    }
    else if(s[r]=='x'){
        return (1+solve(l, r-1));
    }
    //return -1;
    cout << -1, exit(0);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s;
    cout << solve(0, s.length()-1);
    return 0;
} 