#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10, M = 1500, INF = 0x3f3f3f3f;
char s[N];
int dp[N], a[N][30];
int main() {
  while (~scanf("%s", s)) {
    int n = strlen(s);
    memset(a, 0, sizeof(a));
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      dp[i + 1] = i + 1;
      for (int j = 0; j < 26; j++) a[i + 1][j] = a[i][j];
      a[i + 1][int(s[i] - 'a')] = a[i][int(s[i] - 'a')] + 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < i; j++) {
        int ans1 = 0;
        for (int k = 0; k < 26; k++)
          if ((a[i][k] - a[j][k]) % 2 == 1) ans1++;
        if (ans1 > 1)
          dp[i] = min(dp[i], dp[j] + i - j);
        else
          dp[i] = min(dp[i], dp[j] + 1);
      }
    }
    printf("%d\n", dp[n]);
  }
  return 0;
}
