# yukicoder No.279 木の数え上げ from collections import Counter S = input() count = Counter(S) print(min(count["t"], count["r"], count["e"] // 2))