#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int num_n = 0;
  int num_i = 0;
  int num_e = 0;
  int num_t = 0;
  int n = 0;
  int e = 0;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'n')
      num_n++;
    else if (s[i] == 'i')
      num_i++;
    else if (s[i] == 'e')
      num_e++;
    else if (s[i] == 't')
      num_t++;
  }
  if (num_n < 3)
    n = 0;
  else if (num_n == 3)
    n = 1;
  else {
    n = 1 + (num_n - 3) / 2;
  }
  e = num_e / 3;
  int ans = min(num_t, min(num_i, min(n, e)));
  cout << ans;
  return 0;
}
