#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int l = S.length();
  int C[l][26];
  int ans = 100000000;
  for (int _ = 0; _ < 2; ++_) {
    reverse(S.begin(), S.end());
    for (int i = 0; i < l; ++i) {
      fill(C[i], C[i] + 26, 0);
    }
    C[0][S[0] - 'a'] = 1;
    for (int i = 1; i < S.length(); ++i) {
      for (int j = 0; j < 26; ++j) {
        if (j == S[i] - 'a') {
          C[i][S[i] - 'a'] = 1 - C[i - 1][S[i] - 'a'];
        } else {
          C[i][j] = C[i - 1][j];
        }
      }
    }
    int t = 0, s = 0, r[26];
    int ans_ = 0;
    fill(r, r + 26, 0);
    while (s < l) {
      bool f = true;
      for (int i = s; i < l; ++i) {
        bool k = true;
        for (int j = 0; j < 26; ++j) {
          if (C[i][j] - r[j] != 0) {
            k = false;
            break;
          }
        }
        if (k) {
          for (int j = 0; j < 26; ++j) {
            r[j] = C[i][j];
          }
          s = i + 1;
          f = false;
          break;
        }
      }
      if (f) {
        for (int j = 0; j < 26; ++j) {
          r[j] = C[s][j];
        }
        ++ans_;
        ++s;
      }
    }
    ans = min(ans, ans_);
  }
  cout << max(ans, 1) << endl;
  return 0;
}
