#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1e9 + 7;
void rec(const vector<string> &v, const long &n, const long &index,
         const string &s, long long &ans) {
  map<char, long> table;
  map<char, long>::iterator it;
  bool isOne = false;
  bool isNo = false;
  string str = v.back();
  long i, len = str.size();
  for (i = 0; i < len; i++) table[str[i]]++;
  for (it = table.begin(); it != table.end(); it++) {
    if (!isOne && it->second % 2L == 1L) {
      isOne = true;
    } else if (isOne && it->second % 2L == 1L) {
      isNo = true;
      break;
    } else if (it->second % 2L != 0L) {
      isNo = true;
      break;
    }
  }
  if (isNo) {
    return;
  } else if (!isNo && n <= index) {
    if (v.size() < ans) ans = v.size();
    return;
  }
  len = s.size() - index;
  for (i = 1; i <= len; i++) {
    vector<string> vv = vector<string>(v.begin(), v.end());
    vv.push_back(s.substr(index, i));
    rec(vv, n, index + i, s, ans);
  }
}
void solve(const string &s) {
  long long ans = LLONG_MAX;
  vector<string> v;
  long i, len = s.size();
  for (i = 1; i <= len; i++) {
    v.clear();
    v.push_back(s.substr(0, i));
    rec(v, len, i, s, ans);
  }
  cout << ans << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  solve(s);
  return 0;
}
