S=raw_input() tcnt,rcnt,ecnt=0,0,0 for s in S: if s=='t': tcnt+=1 if s=='r': rcnt+=1 if s=='e': ecnt+=1 print min( tcnt, rcnt, ecnt/2 )