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