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,r,e/2].min