#include #define REP(i, n) for (int i = 0; i< (n); i++) using namespace std; int main() { string S; cin >> S; int t = 0; int r = 0; int e = 0; REP(i, (int)S.size()) { char c = S[i]; if (c == 't') t++; else if (c == 'r') r++; else if (c == 'e') e++; } cout << min(min(t, r), e/2) << endl; return 0; }