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