#include using namespace std; namespace { int iCnt[ 10 ]; } int main() { int i; char S[ 1000100 ]; char C; cin >> S; i = 0; while( C = S[ i ] ) { if( C == 't' ) iCnt[ 0 ]++; else if( C == 'r' ) iCnt[ 1 ]++; else if( C == 'e' ) iCnt[ 2 ]++; i++; } iCnt[ 2 ] /= 2; cout << *min_element( iCnt, iCnt + 3 ) << endl; return 0; }