#include <bits/stdc++.h>
using namespace std;
const long long modn = 1e9 + 7;
const int maxn = 2e5 + 9;
map<int, vector<int> > mm;
int val[maxn];
char s[maxn];
bool inque[maxn];
int ans;
int solve(int l) {
  queue<pair<int, int> > q;
  q.push(make_pair(l, 0));
  memset(inque, 0, sizeof(inque));
  inque[l] = true;
  while (!q.empty()) {
    int x = q.front().first;
    int v = q.front().second;
    q.pop();
    if (!x) return v;
    map<int, vector<int> >::iterator it;
    if ((it = mm.find(val[x])) != mm.end()) {
      int l = it->second.size();
      for (int i = 0; i < l; i++) {
        if (it->second[i] >= x) break;
        if (inque[it->second[i]]) continue;
        q.push(make_pair(it->second[i], v + 1));
        inque[it->second[i]] = true;
      }
    }
    for (int j = 0; j < 26; j++) {
      int num = (val[x] ^ (1 << j));
      if ((it = mm.find(num)) != mm.end()) {
        int l = it->second.size();
        for (int i = 0; i < l; i++) {
          if (it->second[i] >= x) break;
          if (inque[it->second[i]]) continue;
          q.push(make_pair(it->second[i], v + 1));
          inque[it->second[i]] = true;
        }
      }
    }
  }
  return -1;
}
int main() {
  while (scanf("%s", s) != EOF) {
    int l = strlen(s);
    mm.clear();
    map<int, vector<int> >::iterator it;
    val[0] = 0;
    for (int i = 0; i < l; i++) {
      val[i + 1] = val[i] ^ (1 << (s[i] - 'a'));
    }
    for (int i = 0; i <= l; i++) {
      if ((it = mm.find(val[i])) == mm.end()) mm[val[i]] = vector<int>(1, i);
    }
    int ans = solve(l);
    printf("%d\n", ans);
  }
  return 0;
}
