#include <bits/stdc++.h>
using namespace std;
vector<int> dp;
void input(string &str) {
  cin >> str;
  dp.resize(str.size(), -1);
}
class word {
 private:
  int can;
  bool line[26];

 public:
  word() {
    can = 0;
    for (int i = 0; i < 26; ++i) {
      line[i] = true;
    }
  }
  bool iscan() { return can <= 1; }
  void add(char ch) {
    int place = ch - 'a';
    bool before = line[place];
    if (before) {
      ++can;
      line[place] = false;
    } else {
      --can;
      line[place] = true;
    }
  }
};
int func(string &str, int place) {
  if (place == str.size()) {
    return 0;
  }
  if (dp[place] >= 0) {
    return dp[place];
  }
  int res = (1 << 31) - 1;
  word wo;
  for (int i = place; i < str.size(); ++i) {
    char ch = str[i];
    wo.add(ch);
    if (wo.iscan()) {
      res = min(res, 1 + func(str, i + 1));
    }
  }
  dp[place] = res;
  return res;
}
int main() {
  string str;
  input(str);
  cout << func(str, 0) << endl;
  return 0;
}
