x=list(input()) count=0 y=[] y_append=y.append for i in x: y_append(i) if "t" in y and "r" in y and y.count("e")>1: count+=1 y.remove("t") y.remove("r") y.remove("e") y.remove("e") else: continue print(count)