#include #include using namespace std; int main() { string s; int t, r, e, ans; cin >> s; t = r = e = ans = 0; for (size_t i = 0; i < s.size(); i++) { switch (s[i]) { case 't': t++; break; case 'r': r++; break; case 'e': e++; break; default: break; } } while (true) { if (t == 0 || r == 0 || e < 2) { break; } ans++; t--; r--; (--e)--; } cout << ans << endl; return 0; }