S=list(input()) t=0 r=0 e=0 for i in range(len(S)): if S[i]=="t": t+=1 elif S[i]=="r": r+=1 elif S[i]=="e": e+=1 t*=2 r*=2 m=t if m>r: m=r if m>e: m=e e//=2 print (e)