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