s=gets a,b,c="tre".chars.map{|k|s.chars.count{|t|t==k}} p [a,b,c/2].min