x=list(input()) count=0 y=[] 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)