input=gets.chomp t_cnt=input.count("t") r_cnt=input.count("r") e_cnt=input.count("e") tree_cnt=e_cnt/2 if(tree_cnt>r_cnt) tree_cnt=r_cnt end if(tree_cnt>t_cnt) tree_cnt=t_cnt end print tree_cnt