s = list(input()) d = {"t":0, "r":0, "e":0} for c in s: if c in d: d[c] += 1 print(min(d["t"], d["r"], d["e"]//2))