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