s=input() t_c=0 r_c=0 e_c=0 for i in range(len(s)): if s[i]=='t': t_c+=1 elif s[i]=='r': t_r+=1 elif s[i]=='e': t_e+=1 print(min(t_c,t_r,t_e//2))