S = input() s = {c: S.count(c) for c in S if c in ['t', 'r', 'e']} if len(s.keys()) == 3: s['e'] //= 2 print(min(s.values())) else: print(0)