#include <bits/stdc++.h>
using namespace std;
int ar[26], need[26];
const int MAXN = 110;
char s[MAXN], t[9] = "nineteen";
int main() {
#pragma warning(disable : 4996)
  scanf(" %s", s);
  int len = strlen(s), ans = 1e9;
  for (int i = 0; i < 8; i++) {
    need[t[i] - 'a']++;
  }
  for (int i = 0; i < len; i++) {
    ar[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (need[i] > 0) {
      if (ar[i] >= need[i]) {
        ar[i] -= need[i];
      } else {
        printf("0");
        return 0;
      }
    }
  }
  need['n' - 'a']--;
  for (int i = 0; i < 26; i++) {
    if (need[i] > 0) ans = min(ans, ar[i] / need[i]);
  }
  printf("%d", ans + 1);
  return 0;
}
