#include <bits/stdc++.h>
using namespace std;
constexpr int Minimum(int a, int b) { return (a < b) ? a : b; }
string Data;
int cnt[30];
int main() {
  cin >> Data;
  for (unsigned int i = 0; i < Data.length(); i++) cnt[Data[i] - 'a']++;
  int Ans = 0x3f3f3f3f;
  Ans = Minimum((cnt['n' - 'a'] - 1) / 2, Ans);
  Ans = Minimum(cnt['e' - 'a'] / 3, Ans);
  Ans = Minimum(cnt['i' - 'a'], Ans);
  Ans = Minimum(cnt['t' - 'a'], Ans);
  cout << Ans;
}
