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