from collections import Counter S = input() c = Counter(S) print(min(c["t"], c["r"], c["e"]//2))