input = gets.chomp count[0] = input.scan("t") count[1] = input.scan("r") count[2] = input.scan("e") / 2 puts count.min