s=gets a=[0]*3 s.chars.each{|k| case k when 't' then a[0]+=1 when 'r' then a[1]+=1 when 'e' then a[2]+=1 end } a[2]/=2 p a.min