from collections import Counter counter = Counter(list(input())) ans = 10**6 ans = min(ans, counter['t'], counter['r'], counter['e'] // 2) print(ans)