#include <bits/stdc++.h>
using namespace std;
string s;
int ns, es, ts, is;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    switch (s[i]) {
      case 'n':
        ns++;
        break;
      case 'e':
        es++;
        break;
      case 't':
        ts++;
        break;
      case 'i':
        is++;
        break;
      default:
        break;
    }
  }
  ns = (ns - 1) / 2;
  es = es / 3;
  cout << min(min(min(ns, es), ts), is) << endl;
  return 0;
}
