#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); string s; cin >> s; int t = 0, r = 0, ee = 0; rep(i,s.size()){ t += (s[i] == 't'); r += (s[i] == 'r'); ee += (s[i] == 'e'); } cout << min(t,min(r,ee/2)) << endl; }