S = input() d = dict(t=0, r=0, e=0) for c in S: if c == "t": d["t"] += 1 elif c == "r": d["r"] += 1 elif c == "e": d["e"] += 1 print(min(d["t"], d["r"], d["e"] // 2))