import math n = input() t = 0 r = 0 e = 0 for i in n: if i == "t": t = t+1 if i == "r": r = r+1 if i == "e": e = e+1 print(min(t,r,math.floor(e/2)))