#!/bin/ruby S = gets.chomp.split('') counter = { 't' => 0, 'r' => 0, 'e' => 0, } S.count.times do | num | if ['t', 'r', 'e'].include?(S[num]) counter[S[num]] += 1 end end puts [counter['t'], counter['r'], counter['e'] / 2].min