#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int arr[26] = {0}, i, size, count;
  size = s.size();
  for (i = 0; i < size; i++) {
    arr[s[i] - 'a']++;
  }
  count = arr[4] / 3;
  count = min(count, arr[8]);
  count = min(count, arr[19]);
  count = min(count, (arr[13] - 1) / 2);
  cout << count;
  return 0;
}
