#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int m = 0, nx = 0, ix = 0, ex = 0, tx = 0;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'n')
      nx++;
    else if (s[i] == 'e')
      ex++;
    else if (s[i] == 'i')
      ix++;
    if (s[i] == 't') tx++;
  }
  m = min(ex / 3, min(ix, tx));
  if (nx > 2 * m + 1)
    cout << m;
  else if (nx >= 3)
    cout << (nx - 1) / 2;
  else
    cout << 0;
}
