s=gets.chomp.chars; t=r=e=0 for ch in s t+=ch=='t' ? 1:0 r+=ch=='r' ? 1:0 e+=ch=='e' ? 1:0 end puts ([t,r,e/2]).min