#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int t = 0, r = 0, e = 0; for(int i = 0; i < s.size(); i++) { if(s[i] == 't') t++; if(s[i] == 'r') r++; if(s[i] == 'e') e++; } cout << min(min(t, r), e / 2) << endl; return 0; }