#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, array[100000], i;
  memset(array, 0, sizeof(array));
  string s, s1;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    array[s[i]]++;
  }
  int ans = min((array['n'] - 1) / 2,
                min(array['e'] / 3, min(array['t'], array['i'])));
  cout << ans << endl;
}
