#coding: utf-8 ##yuki_279 s=[] s=raw_input() count_t=0 count_r=0 count_e=0 for i in xrange(len(s)): if s[i]=='t': count_t+=1 elif s[i]=='r': count_r+=1 elif s[i]=='e': count_e+=1 else: continue res=min(count_t,count_r,count_e/2) print res