#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  map<char, int> a;
  cin >> s;
  for (int i = 0; i < s.size(); i++) a[s[i]]++;
  int ans = 0;
  if (a['n'] > 2)
    if (a['i'] > 0)
      if (a['t'] > 0)
        if (a['e'] > 2) {
          a['n'] -= 2;
          a['i'] -= 1;
          a['t'] -= 1;
          a['e'] -= 3;
          ans++;
        }
  while (a['n'] > 2 && a['i'] > 0 && a['t'] > 0 && a['e'] > 2) {
    a['n'] -= 2;
    a['i'] -= 1;
    a['t'] -= 1;
    a['e'] -= 3;
    ans++;
  }
  cout << ans;
  return 0;
}
