#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const double eps = 1e-10;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
string s;
int nc[26][214514] = {};
int dp[214514] = {};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  for (int i = 0; i < (s.size()); i++) {
    nc[s[i] - 'a'][i + 1]++;
    for (int j = 0; j < (26); j++) {
      nc[j][i + 1] += nc[j][i];
    }
  }
  fill(dp, dp + 214514, (int)1e9);
  dp[0] = 0;
  for (int i = (1); i < (s.size() + 1); i++) {
    for (int j = 0; j < (i); j++) {
      int cnt = 0;
      for (int k = 0; k < (26); k++) {
        if ((nc[k][i] - nc[k][j]) % 2) cnt++;
      }
      if (cnt <= 1) dp[i] = min(dp[i], dp[j] + 1);
      if (cnt > 1) {
        j += cnt - 2;
      }
    }
  }
  cout << dp[s.size()] << endl;
}
