s=gets.chomp t=0 r=0 e=0 (0...s.size).each{|i| t+=1 if s[i] == 't' r+=1 if s[i] == 'r' e+=1 if s[i] == 'e' } puts [t,r,e/2].min