#include <bits/stdc++.h>
using namespace std;
long long a[1000010], d[1000010];
long long b[100010], c[1010][1010];
long long mn = 1e18, mx = -1e18, ans, cnt, sm = 1, n, m, cur;
bool ok, okk, u[1000010], uu[310][310], uk[1000010];
char ck[510][510], ch[100010];
int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
vector<long long> g[900010];
int main() {
  std::ios::sync_with_stdio(false);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    a[s[i] - 'a']++;
  }
  cout << min(a[8], min(a[4] / 3, min(a[19], (a[13] - 1) / 2)));
  return 0;
}
