L = [str(x) for x in str(input())] T = R = E = 0 for x in L: if x == "t": T += 1 elif x == "r": R += 1 elif x == "e": E += 1/2 print(int(min(T,R,E)))