#include <bits/stdc++.h>
int main() {
  char word[110];
  int j = 0, num = 0, length, n = 0, i = 0, e = 0, t = 0;
  gets(word);
  length = strlen(word);
  for (j = 0; j < length; j++) {
    if (word[j] == 'n')
      n++;
    else if (word[j] == 'i')
      i++;
    else if (word[j] == 'e')
      e++;
    else if (word[j] = 't')
      t++;
  }
  while (1) {
    if (n >= 3 && i >= 1 && e >= 3 && t >= 1) {
      num++;
      n = n - 2;
      i--;
      e = e - 3;
      t--;
    } else
      break;
  }
  printf("%d", num);
  return 0;
}
