#include <bits/stdc++.h>
using namespace std;
static const int INF = 0x3f3f3f3f;
int dp[202020];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<int>> cnt(n, vector<int>(26, 0));
  cnt[0][s[0] - 'a']++;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      if (j == s[i] - 'a') {
        cnt[i][j] = (cnt[i - 1][j] + 1) % 2;
        continue;
      }
      cnt[i][j] = cnt[i - 1][j];
    }
  }
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      pq;
  vector<pair<int, int>> tmp;
  for (int i = 0; i < n; i++) {
    for (auto a : tmp) {
      pq.push(a);
    }
    tmp.clear();
    int sum = 0;
    for (int j = 0; j < 26; j++) {
      sum += cnt[i][j];
    }
    if (sum <= 1) {
      dp[i] = 1;
      pq.push(make_pair(dp[i], i));
      continue;
    }
    dp[i] = INF;
    int prev = INF;
    while (!pq.empty()) {
      pair<int, int> J = pq.top();
      pq.pop();
      tmp.push_back(J);
      if (prev < J.first) break;
      int j = J.second;
      int sum = 0;
      for (int k = 0; k < 26; k++) {
        sum += cnt[i][k] != cnt[j][k];
      }
      if (sum <= 1) {
        dp[i] = min(dp[i], dp[j] + 1);
        prev = dp[j];
      }
    }
    pq.push(make_pair(dp[i], i));
  }
  printf("%d\n", dp[n - 1]);
  return 0;
}
