#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int a[10] = {0}, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = -3, ans = 0, x = 0, y;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'n') {
      c1++;
      c5++;
    }
    if (s[i] == 'i') c2++;
    if (s[i] == 'e') c3++;
    if (s[i] == 't') c4++;
  }
  if (c1 >= 3)
    x = 1;
  else
    c5 = 0;
  y = min((c3 / 3), min(c2, c4));
  cout << min((c5 / 2) + x, y);
  return 0;
}
