#include <bits/stdc++.h>
using namespace std;
int n, q = 0, w = 0, e = 0, r = 0;
char s[111];
int main() {
  cin >> s;
  n = strlen(s);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'n') q++;
    if (s[i] == 'i') w++;
    if (s[i] == 'e') e++;
    if (s[i] == 't') r++;
  }
  q--;
  q /= 2;
  e /= 3;
  cout << min(min(q, e), min(w, r));
  return 0;
}
