#include <bits/stdc++.h>
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  int j, minn;
  char arr[101];
  int n = 0, i = 0, e = 0, t = 0;
  scanf("%s", arr);
  for (j = 0; j < strlen(arr); j++) {
    if (arr[j] == 'n')
      n++;
    else if (arr[j] == 'i')
      i++;
    else if (arr[j] == 'e')
      e++;
    else if (arr[j] == 't')
      t++;
    else
      ;
  }
  n = (n - 1) / 2;
  e = e / 3;
  minn = min(n, e);
  minn = min(minn, i);
  minn = min(minn, t);
  printf("%d", minn);
  return 0;
}
