s=gets.chomp.split('') t=s.select{|c|c=='t'}.size r=s.select{|c|c=='r'}.size e=s.select{|c|c=='e'}.size/2 puts [t,r,e].min