#include "iostream" using namespace std; int main(){ string str; int ct,cr,ce; ct = cr = ce = 0; cin >> str; for (auto c : str){ if (c == 't') ct++; else if (c == 'r') cr++; else if (c == 'e') ce++; } cout << min(min(ct,cr),ce/2) << endl; return 0; }