#include <bits/stdc++.h>
using namespace std;
int main() {
  string line;
  int n = 0, i = 0, t = 0, e = 0, min;
  cin >> line;
  for (unsigned int s = 0; s < line.length(); ++s) {
    switch (line[s]) {
      case 'n':
        ++n;
        break;
      case 'i':
        ++i;
        break;
      case 't':
        ++t;
        break;
      case 'e':
        ++e;
        break;
    }
  }
  n -= 1;
  n = n / 2;
  e = e / 3;
  min = n;
  if (t < min) min = t;
  if (i < min) min = i;
  if (e < min) min = e;
  cout << min << endl;
  return 0;
}
