S = list(input()) count = 0 flg = True while flg: flg = False for c in list('tree'): if c in S: S.pop(S.index(c)) else: break else: count += 1 flg = True print(count)