# No.279 木の数え上げ s = input() trees = 0 while True: if 't' in s: s = s.replace('t', '', 1) if 'r' in s: s = s.replace('r', '', 1) if 'e' in s: s = s.replace('e', '', 1) if 'e' in s: s = s.replace('e', '', 1) trees += 1 else: break else: break else: break else: break print(trees)