s = gets t = s.count("t") r = s.count("r") e = s.count("e") puts [t,r,e/2].min