#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int dp[200005];
int cnt[26];
int prv[200005][26];
int main() {
  cin >> s;
  s = 'X' + s;
  n = (int)s.length();
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++)
      prv[i][j] = (s[i - 1] == j + 'a' ? i - 1 : prv[i - 1][j]);
    if (!prv[i][s[i] - 'a']) prv[i][s[i] - 'a'] = i;
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = i;
    int cntodd = 1;
    memset(cnt, 0, sizeof(cnt));
    cnt[s[i - 1] - 'a']++;
    for (int j = i - 1; j >= 0; j--) {
      int ccnntt = 0;
      for (int k = 0; k < 26; k++)
        if ((cnt[k] & 1) && prv[j][k] == j) ccnntt++;
      if (ccnntt > 1) break;
      if (cntodd <= 1) dp[i] = min(dp[i], dp[j] + 1);
      if (j == 0) break;
      if (cnt[s[j - 1] - 'a'] & 1) {
        cntodd--;
      } else {
        cntodd++;
      }
      cnt[s[j - 1] - 'a']++;
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}
