#include <bits/stdc++.h>
using namespace std;
int nineteen(string &s) {
  unordered_map<int, int> mp;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]]++;
  }
  int ans = 0;
  while (1) {
    mp['n'] = mp['n'] - 3;
    if (mp['n'] < 0) break;
    mp['n']++;
    mp['i'] = mp['i'] - 1;
    if (mp['i'] < 0) break;
    mp['e'] = mp['e'] - 3;
    if (mp['e'] < 0) break;
    mp['t'] = mp['t'] - 1;
    if (mp['t'] < 0) break;
    ans++;
  }
  return ans;
}
void mainFun() {
  string s;
  cin >> s;
  cout << nineteen(s);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  mainFun();
  return 0;
}
