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