#include <bits/stdc++.h>
using namespace std;
string s, t;
bool b[26];
bool ch() {
  int tt = 0;
  for (int i = 0; i < 26; i++)
    if (b[i]) tt++;
  return tt <= 1;
}
int left() {
  int res = 0;
  while (s.size()) {
    memset(b, 0, sizeof(b));
    int p = 0;
    for (int i = 0; i < s.size(); i++) {
      int pp = s[i] - 'a';
      if (b[pp])
        b[pp] = 0;
      else
        b[pp] = 1;
      if (ch()) p = i;
    }
    for (int i = 0; i < p + 1; i++) s.erase(s.begin());
    res++;
  }
  return res;
}
int right() {
  reverse(t.begin(), t.end());
  int res = 0;
  while (t.size()) {
    memset(b, 0, sizeof(b));
    int p = 0;
    for (int i = 0; i < t.size(); i++) {
      int pp = t[i] - 'a';
      if (b[pp])
        b[pp] = 0;
      else
        b[pp] = 1;
      if (ch()) p = i;
    }
    for (int i = 0; i < p + 1; i++) t.erase(t.begin());
    res++;
  }
  return res;
}
int main() {
  cin >> s;
  t = s;
  cout << min(left(), right()) << endl;
}
