#include <bits/stdc++.h>
using namespace std;
int main() {
  int b[] = {27, 20, 11, 18, 17, 1, 0};
  char s[100000];
  int a[52] = {0};
  int i, min;
  scanf("%s", s);
  for (i = 0; s[i] != '\0'; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      a[s[i] - 'A' + 26]++;
    }
    if (s[i] >= 'a' && s[i] <= 'z') {
      a[s[i] - 'a']++;
    }
  }
  a[20] /= 2;
  a[0] /= 2;
  min = a[b[0]];
  for (i = 0; i < 7; i++) {
    if (a[b[i]] < min) {
      min = a[b[i]];
    }
  }
  printf("%d\n", min);
  return 0;
}
