#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ctr[26] = {};
  for (int i = 0; i < (int)s.size(); ++i) {
    ctr[(int)s[i] - 'a']++;
  }
  sort(ctr, ctr + 26);
  cout << (int)s.size() - ctr[25] << endl;
}
