#include <bits/stdc++.h>
using namespace std;
const int sigma = 30;
string s;
bool Good(int left, int right) {
  if (left > right) return true;
  std::vector<int> cnt(sigma, 0);
  for (int i = left; i <= right; i++) {
    cnt[s[i] - 'a']++;
  }
  int x = 0;
  for (int i = 0; i < sigma; i++) {
    if (cnt[i] % 2 == 1) {
      x++;
    }
  }
  return (x < 2);
}
int Get(int left, int right) {
  if (Good(left, right)) {
    return 1;
  }
  int ans = right - left + 1, u = left;
  int oddCount = 0;
  vector<int> cnt(sigma, 0);
  for (int i = u; i <= right; i++) {
    if (cnt[s[i] - 'a'] % 2 == 1) {
      cnt[s[i] - 'a'] = 0;
      oddCount--;
    } else {
      cnt[s[i] - 'a'] = 1;
      oddCount++;
    }
    if (oddCount == 1) {
      ans = min(ans, 1 + Get(i + 1, right));
    }
  }
  return ans;
}
int main() {
  cin >> s;
  cout << Get(0, (int)s.size() - 1);
  return 0;
}
