#include <bits/stdc++.h>
using namespace std;
const int MAX = 200000 + 10;
map<pair<int, int>, int> dp;
char arr[MAX];
int sum[MAX][26];
bool ispal(int l, int r) {
  int cnt = 0;
  for (int i = 0; i < 26; i++) {
    if ((sum[r][i] - sum[l - 1][i]) % 2 == 1) cnt++;
  }
  return cnt <= 1;
}
int solve(int l, int r) {
  if (l == r) return 1;
  if (l > r) return 0;
  if (dp.find(make_pair(l, r)) != dp.end()) return dp[make_pair(l, r)];
  if (ispal(l, r)) return dp[make_pair(l, r)] = 1;
  int l1 = l, r1 = r, l2 = l, r2 = r;
  while (!ispal(l1, r1)) {
    vector<int> tar;
    for (int i = 0; i < 26; i++) {
      if ((sum[r1][i] - sum[l1 - 1][i]) % 2 == 1) tar.push_back(i);
    }
    int sl = l1, sr = r1;
    while (sl < sr) {
      int mid = (sl + sr + 1) / 2;
      int cc = 0;
      for (int i = 0; i < 26; i++) {
        if (sum[r1][i] != sum[mid - 1][i]) cc++;
      }
      if (cc >= (int)tar.size() - 1)
        sl = mid;
      else
        sr = mid - 1;
    }
    r1 = sl - 1;
  }
  while (!ispal(l2, r2)) {
    vector<int> tar;
    for (int i = 0; i < 26; i++) {
      if ((sum[r2][i] - sum[l2 - 1][i]) % 2 == 1) tar.push_back(i);
    }
    int sl = l2, sr = r2;
    while (sl < sr) {
      int mid = (sl + sr) / 2;
      int cc = 0;
      for (int i = 0; i < 26; i++) {
        if (sum[mid][i] != sum[l2 - 1][i]) cc++;
      }
      if (cc >= (int)tar.size() - 1)
        sr = mid;
      else
        sl = mid + 1;
    }
    l2 = sl + 1;
  }
  return dp[make_pair(l, r)] = min(solve(r1 + 1, r), solve(l, l2 - 1)) + 1;
}
void solve() {
  int n;
  scanf("%s", arr + 1);
  n = strlen(arr + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) {
      sum[i][j] = sum[i - 1][j];
    }
    sum[i][arr[i] - 'a']++;
  }
  printf("%d\n", solve(1, n));
}
void init() {}
int main() {
  init();
  solve();
  return 0;
}
