#include <bits/stdc++.h>
char s[200010];
int min = 1e9;
void f(int t, int v) {
  int i, c = 0, b[30] = {};
  char a;
  for (i = t; s[i]; i++) {
    b[s[i] - 'a']++;
    if (b[s[i] - 'a'] % 2)
      c++;
    else
      c--;
    if (c == 0) a = 0;
    if (c == 1) {
      if (s[i] - a) {
        a = s[i];
        f(i + 1, v + 1);
      }
    }
  }
  if (c < 2 && min > v) min = v;
}
int main() {
  scanf("%s", s);
  f(0, 1);
  printf("%d\n", min);
}
