#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() using namespace std; typedef long long int ll; typedef pair P; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector

vp; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} #define MAX_N 200005 int main() { string s; cin >> s; int cnt[3] = {}; rep(i,s.size()){ if(s[i] == 't')cnt[0]++; if(s[i] == 'r')cnt[1]++; if(s[i] == 'e')cnt[2]++; } int ans = min(min(cnt[0], cnt[1]), cnt[2]/2); cout << ans << endl; return 0; }