#include using namespace std; int main(){ string S; int tcnt = 0; int rcnt = 0; int ecnt = 0; cin >> S; for(int i = 0; i < S.size(); ++i){ if(S[i] == 't'){ tcnt++; } else if(S[i] == 'r'){ rcnt++; } else if(S[i] == 'e'){ ecnt++; } } if( (tcnt*2 == ecnt) && (tcnt == rcnt)){ cout << tcnt << endl; } return 0; }