#include <bits/stdc++.h>
using namespace std;
const int N = -1;
const int INF = 1.01e9;
const int ALF = 26;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    a[i] = s[i] - 'a';
  }
  mt19937 rnd(1919);
  vector<long long> hh;
  for (int i = 0; i < ALF; i++) {
    hh.push_back(rnd() + ((rnd() * 1ll) << 28));
  }
  vector<long long> pref;
  pref.push_back(0);
  for (auto x : a) {
    pref.push_back(pref.back() ^ hh[x]);
  }
  vector<int> dp(n + 1, INF);
  dp[0] = 0;
  map<long long, int> last;
  for (int i = 0; i < (int)pref.size(); i++) {
    last[pref[i]] = i;
  }
  auto upd = [](int& A, int B) { A = min(A, B); };
  for (int i = 0; i < n; i++) {
    if (last[pref[i]] > i) {
      upd(dp[last[pref[i]]], dp[i] + 1);
    }
    for (int j = 0; j < ALF; j++) {
      long long newMask = pref[i] ^ hh[j];
      if (last[newMask] > i) {
        upd(dp[last[newMask]], dp[i] + 1);
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}
