r = gets.chomp.chars.sort.group_by {|x| x}.map{|k,v| [k, v.size]}.to_h puts [r.dig("t") || 0, r.dig("r") || 0, (r.dig("e") || 0) / 2].min