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