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