#include using namespace std; int main() { string S; cin>>S; mapmp; for(char c:S)mp[c]++; cout << min({mp['t'],mp['r'],mp['e']/2}) << endl; }