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': r_c+=1 elif s[i]=='e': e_c+=1 print(min(t_c,r_c,e_c//2))