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