s = input() t_count = 0 r_count = 0 e_count = 0 for char in s: if char == 't': t_count += 1 elif char == 'r': r_count += 1 if char == 'e': e_count += 1 print(min([t_count, r_count, e_count//2]))