#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> a(26);
  for (int i = 0; i < (int)(s.size()); i++) {
    int c = s[i] - 0x61;
    a[c]++;
  }
  int m = 2000000;
  for (int i = 0; i < (int)(26); i++) {
    if (a[i] != 0 && a[i] < m) m = a[i];
  }
  cout << s.size() - m << endl;
}
