s=gets.chomp t=s.scan(/t/).count r=s.scan(/r/).count e=s.scan(/e/).count puts [t,r,e/2].min