#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int i, n = 0, e = 0, ii = 0, t = 0;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'n') {
      n++;
    }
    if (s[i] == 'e') {
      e++;
    }
    if (s[i] == 'i') ii++;
    if (s[i] == 't') t++;
  }
  n--;
  cout << min(n / 2, min(e / 3, min(ii, t))) << endl;
}
