#include <bits/stdc++.h>
using namespace std;
bool isCheck(string s, int left, int right) {
  int kind = 0;
  int alpha[26];
  for (int i = 0; i < 26; i++) alpha[i] = 0;
  for (int i = left; i < right; i++) {
    alpha[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (alpha[i] % 2 == 1) kind++;
  }
  return kind <= 1;
}
int Solve(string s, int l, int r) {
  int left = 1e9, right = 1e9;
  if (isCheck(s, l, r)) {
    return 1;
  }
  for (int i = r - 1; i > l; i--) {
    if (isCheck(s, l, i)) {
      left = min(left, Solve(s, l, i));
      right = min(right, Solve(s, i, r));
    }
  }
  return left + right;
}
int main(void) {
  string s;
  cin >> s;
  cout << Solve(s, 0, s.size()) << endl;
  return 0;
}
