#include <bits/stdc++.h>
using namespace std;
int a[26];
int main() {
  int n = 0, i = 0, t = 0, e = 0, N = 0;
  string s;
  cin >> s;
  for (int k = 0; k < s.size(); ++k) {
    if (s[k] == 'e') ++e;
    if (s[k] == 'i') ++i;
    if (s[k] == 't') ++t;
    if (s[k] == 'n') {
      ++n;
      if (n == 3) {
        ++N;
        n = 1;
      }
    }
  }
  e /= 3;
  cout << min(min(t, N), min(i, e));
  return 0;
}
