S = list(input()) t_cnt=0 r_cnt=0 e_cnt=0 for s in S: if s=="t": t_cnt+=1 elif s=="r": r_cnt+=1 elif s=="e": e_cnt+=1 print(min(t_cnt,r_cnt,(e_cnt)//2))