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