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