#include <bits/stdc++.h>
using namespace std;
string s; int t, r, e;
int main() {
	cin >> s;
	for(char c : s) {
		if(c == 't') t++;
		if(c == 'r') r++;
		if(c == 'e') e++;
	}
	cout << min({t, r, e / 2}) << endl;
	return 0;
}