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