#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
char a[maxn];
int dp[maxn];
int calc(int p) {
  if (dp[p] != -1) return dp[p];
  bool cnt[26];
  int odd = 0;
  for (int i = 0; i < 26; i++) cnt[i] = false;
  int ans = n + 10;
  for (int i = p; i >= 1; i--) {
    int tmp = a[i] - 'a';
    cnt[tmp] = (!cnt[tmp]);
    if (cnt[tmp])
      odd++;
    else
      odd--;
    if (odd <= 1) ans = min(ans, calc(i - 1) + 1);
  }
  return dp[p] = ans;
}
int main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  for (int i = 1; i <= n; i++) dp[i] = -1;
  dp[0] = 0;
  int ans = calc(n);
  printf("%d\n", ans);
  return 0;
}
