#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e12;
long long dp[200010];
struct RSQ {
  long long n;
  vector<long long> dat;
  RSQ() {}
  RSQ(long long n_) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, 0);
  }
  void add(long long k, long long a) {
    k += n - 1;
    dat[k] += a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = dat[2 * k + 1] + dat[2 * k + 2];
    }
  }
  long long query(long long a, long long b) { return query(a, b, 0, 0, n); }
  long long query(long long a, long long b, long long k, long long l,
                  long long r) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return dat[k];
    long long vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    long long vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return vl + vr;
  }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  long long n = s.size();
  RSQ r(n + 1);
  long long d[26] = {};
  for (long long i = 1; i < n + 1; i++) {
    long long c = 1;
    d[s[i - 1] - 'a']++;
    if (d[s[i - 1] - 'a'] % 2) c = -1;
    r.add(i, c * (1LL << (long long)(s[i - 1] - 'a')));
  }
  for (long long i = 0; i < 200010; i++) dp[i] = i;
  dp[0] = 0;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 1; j < i; j++) {
      long long tmp = r.query(j, i + 1);
      long long cnt = 0;
      if (tmp < 0) tmp *= -1;
      for (long long k = 0; k < 26; k++)
        if (tmp & (1LL << k)) cnt++;
      if (cnt > 1) continue;
      dp[i] = min(dp[i], dp[j - 1] + 1);
    }
  }
  cout << dp[n] << endl;
}
