#include <bits/stdc++.h>
using namespace std;
struct edge {
  int from, to;
  long long cost;
};
string s;
int dfs(int left, int right, map<char, int> mp) {
  if (left == right) return 1;
  int candidate[2], odd_num;
  odd_num = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    if (itr->second % 2 == 1) odd_num++;
  }
  if (odd_num <= 1) return 1;
  map<char, int> mptmp1(mp), newmp1;
  for (int i = right; i >= left; i--) {
    mptmp1[s[i]]--;
    newmp1[s[i]]++;
    odd_num = 0;
    for (auto itr = mptmp1.begin(); itr != mptmp1.end(); itr++) {
      if (itr->second % 2 == 1) odd_num++;
    }
    if (odd_num <= 1) {
      candidate[0] = i;
      break;
    }
  }
  map<char, int> mptmp2(mp), newmp2;
  for (int i = left; i < right + 1; i++) {
    mptmp2[s[i]]--;
    newmp2[s[i]]++;
    odd_num = 0;
    for (auto itr = mptmp2.begin(); itr != mptmp2.end(); itr++) {
      if (itr->second % 2 == 1) odd_num++;
    }
    if (odd_num <= 1) {
      candidate[1] = i;
      break;
    }
  }
  int a = 1 + dfs(candidate[0], right, newmp1);
  int b = dfs(left, candidate[1], newmp2) + 1;
  return min(a, b);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  int n = (int)s.length();
  map<char, int> mp;
  for (int i = 0; i < n; i++) {
    mp[s[i]]++;
  }
  int left = 0, right = n - 1;
  cout << dfs(left, right, mp);
}
