s = input() t_c = s.count(("t")) r_c = s.count(("r")) e_c = s.count(("e")) // 2 print(min(t_c,r_c,e_c))