#include <bits/stdc++.h>
using namespace std;
template <typename T0, typename T1>
std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) {
  for (typename map<T0, T1>::const_iterator p = v.begin(); p != v.end(); p++) {
    os << p->first << ": " << p->second << " ";
  }
  return os;
}
template <typename T0, typename T1>
std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) {
  os << v.first << ": " << v.second << " ";
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << " ";
  }
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << endl;
  }
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const set<T>& v) {
  vector<T> tmp(v.begin(), v.end());
  os << tmp;
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const deque<T>& v) {
  vector<T> tmp(v.begin(), v.end());
  os << tmp;
  return os;
}
string s;
vector<vector<long long> > nxt;
vector<long long> isOdd(26);
map<pair<long long, long long>, long long> memo;
long long f(long long l, long long r, long long N,
            vector<vector<long long> >& hi) {
  auto key = make_pair(l, r);
  if (memo.count(key)) return memo[key];
  long long odd = 0;
  for (int c = 0, _n = (26); (c) < (int)_n; ++c)
    if ((hi[c][r + 1] - hi[c][l - 1 + 1]) % 2 == 1) odd++, isOdd[c] = 1;
  if (odd <= 1) {
    return memo[key] = 1;
  } else {
    long long lans = 1LL << 60;
    for (int c = 0, _n = (26); (c) < (int)_n; ++c)
      if (isOdd[c]) {
        long long m = s[l] == c ? 1 : nxt[c][l + 1];
        if (m == -1) continue;
        m--;
        long long odd = 0;
        for (int c = 0, _n = (26); (c) < (int)_n; ++c)
          if ((hi[c][m + 1] - hi[c][l - 1 + 1]) % 2 == 1) odd++;
        if (odd <= 1) {
          if (m < r) lans = min(lans, f(l, m, N, hi) + f(m + 1, r, N, hi));
        }
      }
    return memo[key] = lans;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  while (cin >> s) {
    memo.clear();
    long long N = s.size();
    nxt = vector<vector<long long> >(26, vector<long long>(N, -1));
    vector<vector<long long> > hi(26, vector<long long>(N + 1));
    for (int i = 0, _n = (N); (i) < (int)_n; ++i) {
      for (int j = 0, _n = (26); (j) < (int)_n; ++j) hi[j][i + 1] = hi[j][i];
      hi[s[i] - 'a'][i + 1]++;
    }
    for (long long i = N - 1; i >= 0; i--) {
      if (i + 1 < N)
        for (int c = 0, _n = (26); (c) < (int)_n; ++c)
          nxt[c][i] = nxt[c][i + 1];
      nxt[s[i] - 'a'][i] = i;
    }
    long long ans = f(0, N - 1, N, hi);
    cout << ans << endl;
  }
  return 0;
}
