a=input() b=0 c=0 d=0 for i in a: if i=="t": b+=1 elif i=="r": c+=1 elif i=="e": d+=1 e=[] e.append(b) e.append(c) e.append(d//2) print(min(e))