#include #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define FFOR(i,a,b) for(int i=(a);i<=(b);i++) #define REP(i,b) FOR(i,0,b) #define RREP(i,b) FFOR(i,1,b) #define PB push_back #define F first #define S second #define BE(c) c.begin(),c.end() using namespace std; typedef long long LL; typedef int ut; typedef long double ld; typedef pair pr; typedef vector Vpr; typedef vector VI; typedef pair ppr; typedef vector Vppr; typedef priority_queue > PQ; typedef priority_queue > PprQ; const int SIZE=5+3*1e+5; const ut INF=1<<30; const ld eps=1e-6; const LL p=7+1e+9; int nums[SIZE]; int main(){ string s; cin >> s; REP(i,s.size()) nums[s[i]-'a']++; cout << min(min(nums['t'-'a'],nums['r'-'a']),nums['e'-'a']/2) << endl; }