t=r=e=0 gets.chomp.split("").map{|w| t += 2 if w == "t" r += 2 if w == "r" e += 1 if w == "e" } p [t/2,r/2,e/2].min