s = gets.chomp!.gsub(/[^tre]/o, '') t, r, e = %w(t r e).map{|c| s.count(c) } e /= 2 puts [t, r, e].min