S = list(input()) ans = 0 while True: # t for i in range(len(S)): if S[i] == 't': S[i] = 'T' break else: break # r for i in range(len(S)): if S[i] == 'r': S[i] = 'R' break else: break # e for i in range(len(S)): if S[i] == 'e': S[i] = 'E' break else: break # e for i in range(len(S)): if S[i] == 'e': S[i] = 'E' ans += 1 break else: break print(ans)