h = {'t' => 0, 'r' => 0, 'e' => 0} gets.chomp.gsub(/[^tre]/, '').chars.each do |c| h[c] += 1 end h['e'] /= 2 puts h.values.min