#include <bits/stdc++.h>
using namespace std;
string s;
vector<long long> edge[200200];
long long cnt[26];
void kai(long long l) {
  memset(cnt, 0, sizeof(cnt));
  long long ki = 0;
  for (long long r = l; r < s.size(); r++) {
    cnt[s[r] - 'a']++;
    if (cnt[s[r] - 'a'] % 2 == 0) {
      ki--;
    } else {
      ki++;
    }
    if (ki == 0 || ki == 1) {
      edge[r + 1].push_back(l);
    }
  }
}
long long d[200200];
long long bfs() {
  queue<pair<long long, long long> > que;
  for (long long i = 0; i < (200200); ++i) {
    d[i] = (1ll << 60);
  }
  d[s.size()] = 0;
  que.push(pair<long long, long long>(s.size(), 0));
  while (que.size()) {
    long long v = que.front().first;
    long long di = que.front().second;
    que.pop();
    if (di > d[v]) continue;
    for (long long i = 0; i < (edge[v].size()); ++i) {
      long long to = edge[v][i];
      if (to == 0) return min(di + 1, d[to]);
      if (d[to] > di + 1) {
        d[to] = di + 1;
        que.push(pair<long long, long long>(to, di + 1));
      }
    }
  }
}
signed main() {
  cin >> s;
  for (long long i = 0; i < (s.size()); ++i) {
    kai(i);
  }
  cout << bfs() << endl;
}
