#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
int num_edge = 0, head[100000];
struct Edge {
  int nxt, to;
} edge[100000];
LL n, m, sum = 0, f[1000000] = {}, W[1000][1000] = {}, now = 0;
string S, str[1000000];
bitset<26> bi = {}, B[1000000] = {};
void add_edge(int from, int to) {
  edge[++num_edge].nxt = from;
  edge[num_edge].to = to;
  head[from] = num_edge;
}
LL dp[300000];
char c;
int main() {
  cin >> S;
  for (LL i = 0; i < S.size(); i++) {
    if (i > 0) B[i] = B[i - 1];
    B[i][S[i] - 'a'].flip();
  }
  n = 0;
  m = 0;
  for (LL i = 0; i < 20004; i++) dp[i] = INF;
  dp[0] = 0;
  for (LL i = 0; i < S.size(); i++) {
    bi = {};
    for (LL j = i; j < S.size(); j++) {
      bi = (i == 0 ? B[j] : (B[j] ^ B[i - 1]));
      if (bi.count() < 2) dp[j + 1] = min(dp[j] + 1, min(dp[i] + 1, dp[j + 1]));
    }
  }
  cout << dp[S.size()] << endl;
  return 0;
}
