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