#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<int> tmp;
  for (int i = 0; i < S.size(); i++) {
    int ret = 0;
    int alpha[26] = {};
    for (int j = i; j < S.size(); j++) {
      alpha[S[j] - 'a']++;
      int flag = 0;
      for (int k = 0; k < 26; k++) {
        if (alpha[k] % 2 == 1) {
          if (flag == 0)
            flag = 1;
          else if (flag == 1) {
            flag = 2;
            break;
          }
        }
      }
      if (flag < 2) ret = j - i;
    }
    tmp.push_back(ret);
  }
  int ans = 10000;
  for (int i = 0; i < S.size(); i++) {
    int n = tmp[i] + (i + 1);
    int res = i + 1;
    while (1) {
      if (n >= S.size()) break;
      res++;
      n += tmp[n] + 1;
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}
