#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int len = 0, cn = 0, ci = 0, ce = 0, ct = 0;
  while (s[len] != '\0') {
    if (s[len] == 'n')
      cn += 1;
    else if (s[len] == 'i')
      ci += 1;
    else if (s[len] == 'e')
      ce += 1;
    else if (s[len] == 't')
      ct += 1;
    ++len;
  }
  cn -= 1;
  cn /= 2;
  ci /= 1;
  ce /= 3;
  ct /= 1;
  if (cn == 0 || ci == 0 || ce == 0 || ct == 0)
    cout << 0 << endl;
  else {
    if (cn >= ci && ce >= ci && ct >= ci)
      cout << ci << endl;
    else if (ci >= cn && ce >= cn && ct >= cn)
      cout << cn << endl;
    else if (cn >= ce && ci >= ce && ct >= ce)
      cout << ce << endl;
    else if (ce >= ct && cn >= ct && ci >= ct)
      cout << ct << endl;
  }
  return 0;
}
