#include using namespace std; int main(){ string s; cin >> s; int t = 0; int r = 0; int e = 0; for(int i = 0; i < s.length(); i++){ if(s[i] == 't')t++; else if(s[i] == 'r')r++; else if(s[i] == 'e')e++; } int ans = min(t, min(r, e / 2)); cout << ans << endl; }