#include <bits/stdc++.h>
using namespace std;
long long n, f[27], curr[27], cont;
int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.size(); i++) {
    if (curr[a[i]] == 0)
      n++;
    else {
      n--;
    }
    curr[a[i]] ^= 1;
    f[n] = i;
  }
  if (f[0] == a.size() - 1) {
    cout << 1 << endl;
    return 0;
  }
  cont = 1;
  while (f[cont] != a.size() - 1) {
    cont++;
  }
  cout << cont << endl;
  return 0;
}
