#include <bits/stdc++.h>
using namespace std;
string s;
int A[100100];
int main() {
  cin >> s;
  int a = 0;
  for (int i = 0; i < (int)s.size(); ++i) {
    int x;
    if (s[i] >= 'A' && s[i] <= 'Z') {
      x = s[i] - 'A';
      if (x == 1) a++;
    } else if (s[i] >= 'a' && s[i] <= 'z') {
      x = s[i] - 'a';
      A[x]++;
    }
  }
  int mn = 10000100;
  for (int i = 0; i < 30; ++i) {
    if (i == 1 || i == 11 || i == 18 || i == 17) {
      if (A[i] < mn) mn = A[i];
    } else if (i == 0 || i == 20) {
      int x = A[i] / 2;
      if (x < mn) mn = x;
    }
  }
  if (a < mn) mn = a;
  cout << mn;
  return 0;
}
