#include #define rep(i,n) for(int i=0; i<(n); i++) using namespace std; typedef long long ll; int main(){ string s; cin>>s; int t,r,e; t=r=e=0; rep(i,s.size()){ if(s[i]=='t') t++; if(s[i]=='r') r++; if(s[i]=='e') e++; } int ans=0; while(1){ t-=1; r-=1; e-=2; if(t<0||r<0||e<0) break; else ans++; } cout << ans << endl; }