#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (const auto &v : vec) {
    os << v << ",";
  }
  os << "]";
  return os;
}
void solve() {
  string s;
  cin >> s;
  vector<int> count[26];
  for (i64 i = i64(0), i_max_for_repmacro = i64(26); i < i_max_for_repmacro;
       ++i)
    count[i].resize(s.size());
  ++count[s[0] - 'a'][0];
  for (i64 i = i64(1), i_max_for_repmacro = i64(s.size());
       i < i_max_for_repmacro; ++i) {
    for (i64 j = i64(0), j_max_for_repmacro = i64(26); j < j_max_for_repmacro;
         ++j)
      count[j][i] = count[j][i - 1];
    ++count[s[i] - 'a'][i];
  }
  vector<int> memo(s.size() + 1, inf);
  vector<bool> done(s.size() + 1);
  function<int(int)> rec = [&](int l) {
    int &res = memo[l];
    if (done[l]) return res;
    done[l] = true;
    if (l == s.size()) return res = 0;
    for (int r = s.size() - 1; r >= l; --r) {
      int odd = 0;
      for (i64 j = i64(0), j_max_for_repmacro = i64(26); j < j_max_for_repmacro;
           ++j)
        if ((count[j][r] - (l ? count[j][l - 1] : 0)) % 2) {
          ++odd;
          if (odd > 1) break;
        }
      if (odd == 1) {
        res = min(res, rec(r + 1) + 1);
        if (res <= 2) return res;
      }
    }
    return res;
  };
  cout << rec(0) << endl;
}
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}
