S = list(input()) c_t = 0 c_r = 0 c_e = 0 for s in S: if s == "t": c_t += 1 if s == "r": c_r += 1 if s == "e": c_e += 1 print(min(c_t, c_r, c_e//2))