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

int main() {
  string s; cin >> s;
  int l = 0, r = s.length() - 1;
  int ans = 0;
  while (l <= r) {
    if (s[l] == s[r]) {
      l++; r--;
    } else {
      if (s[l] == 'x') {
        l++;
        ans++;
      } else if (s[r] == 'x') {
        r--;
        ans++;
      } else {
        ans = -1;
        break;
      }
    }
  }
  cout << ans << endl;
}
