s=input() d={} for i in s: if i=="t": if "t" not in d: d["t"]=1 else: d["t"]+=1 elif i=="r": if "r" not in d: d["r"]=1 else: d["r"]+=1 elif i=="e": if "e" not in d: d["e"]=1 else: d["e"]+=1 a=0 if d["t"]>=1 and d["r"]>=1 and d["e"]>=2: a=min([d["t"],d["r"],d["e"]//2]) print(a)