#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> seen(200010, vector<int>(26));
bool is_palin(string S, int i, int j) {
  vector<int> ch = seen[j];
  vector<int> ch2 = seen[i];
  int odd = 0;
  int even = 0;
  for (int i = 0; i < (int)(26); ++i) {
    auto tmp = ch[i] - ch2[i];
    if (tmp % 2)
      ++odd;
    else
      ++even;
  }
  return odd <= 1;
}
map<pair<int, int>, int> cache;
int solve2(string S, int i, int j) {
  if (i + 1 == j) return 1;
  if (cache.count(make_pair(i, j))) return cache[make_pair(i, j)];
  if (is_palin(S, i, j)) return 1;
  int ans = 1e9;
  for (int k = (i + 1); k < (int)(j); ++k) {
    if (is_palin(S, i, k)) {
      ans = min(ans, 1 + solve2(S, k, j));
    }
  }
  cache[make_pair(i, j)] = ans;
  return ans;
}
int solve(string S) {
  vector<int> chs(26);
  for (int i = 0; i < (int)(((int)S.size())); ++i) {
    auto tmp = S[i] - 'a';
    ++chs[tmp];
    seen[i + 1] = chs;
  }
  return solve2(S, 0, ((int)S.size()));
  map<char, int> count;
  for (auto ch : S) {
    ++count[ch];
  }
  int odd = 0;
  int even = 0;
  for (auto kv : count) {
    if (kv.second % 2) {
      ++odd;
    } else {
      ++even;
    }
  }
  if (odd <= 1) {
    return 1;
  }
  int ans = 0;
  if (odd == 0) {
    ans = 1;
  } else {
    ans = odd;
  }
  return ans;
}
int main(void) {
  cin.sync_with_stdio(false);
  string S;
  cin >> S;
  cout << solve(S) << endl;
  return 0;
}
