str = gets.to_s a = Array.new(3, 0) str.length.times do |i| if str[i] == "t" a[0] += 1 elsif str[i] == "r" a[1] += 1 elsif str[i] == "e" a[2] += 1 end end a[2] /= 2 a.sort! puts a[0]