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